Answer addressbook-home-set, fix the collection children detection
This commit is contained in:
		| @@ -230,8 +230,9 @@ class Collection(object): | ||||
|                     result.append(cls(path, principal)) | ||||
|                 try: | ||||
|                     for filename in next(os.walk(abs_path))[2]: | ||||
|                         if cls.is_collection(os.path.join(abs_path, filename)): | ||||
|                             result.append(cls(os.path.join(path, filename))) | ||||
|                         collection = cls(os.path.join(path, filename)) | ||||
|                         if collection.exists: | ||||
|                             result.append(collection) | ||||
|                 except StopIteration: | ||||
|                     # Directory does not exist yet | ||||
|                     pass | ||||
| @@ -245,11 +246,12 @@ class Collection(object): | ||||
|                 result.extend(collection.components) | ||||
|         return result | ||||
|  | ||||
|     def is_collection(self, path): | ||||
|         """Return ``True`` if there is a collection file under ``path``.""" | ||||
|     @property | ||||
|     def exists(self): | ||||
|         """Return ``True`` if there is a collection file exists.""" | ||||
|         beginning_string = 'BEGIN:%s' % self.tag | ||||
|         with open(path) as stream: | ||||
|             beginning_string = stream.read(len(beginning_string)) | ||||
|         with open(self.path) as stream: | ||||
|             return beginning_string == stream.read(len(beginning_string)) | ||||
|  | ||||
|     @property | ||||
|     def items(self): | ||||
|   | ||||
| @@ -242,6 +242,7 @@ def _propfind_response(path, item, props, user): | ||||
|         elif tag in ( | ||||
|             _tag("D", "principal-collection-set"), | ||||
|             _tag("C", "calendar-user-address-set"), | ||||
|             _tag("CR", "addressbook-home-set"), | ||||
|             _tag("C", "calendar-home-set")): | ||||
|             tag = ET.Element(_tag("D", "href")) | ||||
|             tag.text = path | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Guillaume Ayoub
					Guillaume Ayoub