diff --git a/.project b/.project deleted file mode 100644 index 9493099..0000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Radicale - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/.pydevproject b/.pydevproject deleted file mode 100644 index 09e3605..0000000 --- a/.pydevproject +++ /dev/null @@ -1,10 +0,0 @@ - - - - - -/Radicale - -python 2.7 -Default - diff --git a/.pylintrc b/.pylintrc index 5faf833..3b459a4 100644 --- a/.pylintrc +++ b/.pylintrc @@ -89,7 +89,7 @@ generated-members= [FORMAT] # Maximum number of characters on a single line. -max-line-length=80 +max-line-length=79 # Maximum number of lines in a module max-module-lines=1000 diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 864a84b..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Sat Aug 04 10:58:22 CEST 2012 -eclipse.preferences.version=1 -encoding//radicale/__init__.py=utf-8 -encoding//radicale/__main__.py=utf-8 diff --git a/radicale/acl/PAM.py b/radicale/acl/PAM.py index 3f6a199..68ea857 100644 --- a/radicale/acl/PAM.py +++ b/radicale/acl/PAM.py @@ -47,7 +47,7 @@ def is_authenticated(user, password): # Check whether the group exists try: - members = grp.getgrnam(GROUP_MEMBERSHIP) + members = grp.getgrnam(GROUP_MEMBERSHIP).gr_mem except KeyError: log.LOGGER.debug( "The PAM membership required group (%s) doesn't exist" % diff --git a/radicale/acl/courier.py b/radicale/acl/courier.py index c5bd7b9..462cfbe 100644 --- a/radicale/acl/courier.py +++ b/radicale/acl/courier.py @@ -51,7 +51,7 @@ def is_authenticated(user, password): # Address, HOME, GID, and either UID or USERNAME are mandatory in resposne # see http://www.courier-mta.org/authlib/README_authlib.html#authpipeproto for line in data.split(): - if 'GID' in line: + if "GID" in line: return True # default is reject diff --git a/radicale/config.py b/radicale/config.py index faa492e..c484e9b 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -53,8 +53,10 @@ INITIAL_CONFIG = { "type": "None", "public_users": "public", "private_users": "private", - "httpasswd_filename": "/etc/radicale/users", - "httpasswd_encryption": "crypt", + "htpasswd_filename": "/etc/radicale/users", + "htpasswd_encryption": "crypt", + "imap_auth_host_name": "localhost", + "imap_auth_host_port": "143", "ldap_url": "ldap://localhost:389/", "ldap_base": "ou=users,dc=example,dc=com", "ldap_attribute": "uid", @@ -66,10 +68,10 @@ INITIAL_CONFIG = { "courier_socket": ""}, "storage": { "type": "filesystem", - "filesystem_folder": - os.path.expanduser("~/.config/radicale/collections"), - "git_folder": - os.path.expanduser("~/.config/radicale/collections")}, + "filesystem_folder": os.path.expanduser( + "~/.config/radicale/collections"), + "git_folder": os.path.expanduser( + "~/.config/radicale/collections")}, "logging": { "config": "/etc/radicale/logging", "debug": "False", diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index 6d3a92a..9a38755 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -240,11 +240,10 @@ def _propfind_response(path, item, props, user): tag = ET.Element(_tag("D", "href")) tag.text = path element.append(tag) - elif tag in ( - _tag("D", "principal-collection-set"), - _tag("C", "calendar-user-address-set"), - _tag("CR", "addressbook-home-set"), - _tag("C", "calendar-home-set")): + 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 element.append(tag) @@ -284,12 +283,14 @@ def _propfind_response(path, item, props, user): if item.is_principal: tag = ET.Element(_tag("D", "principal")) element.append(tag) - if item.is_leaf(item.path): - tag = ET.Element(_tag("C", item.resource_type)) - element.append(tag) - if not item.exists and item.resource_type: - # Collection not stored yet, but guessed resource type - tag = ET.Element(_tag("C", item.resource_type)) + if item.is_leaf(item.path) or ( + not item.exists and item.resource_type): + # 2nd case happens when the collection is not stored yet, + # but the resource type is guessed + if item.resource_type == "addressbook": + tag = ET.Element(_tag("CR", item.resource_type)) + else: + tag = ET.Element(_tag("C", item.resource_type)) element.append(tag) tag = ET.Element(_tag("D", "collection")) element.append(tag) @@ -300,6 +301,8 @@ def _propfind_response(path, item, props, user): elif tag == _tag("C", "calendar-timezone"): element.text = ical.serialize( item.tag, item.headers, item.timezones) + elif tag == _tag("D", "displayname"): + element.text = item.name else: human_tag = _tag_from_clark(tag) if human_tag in collection_props: @@ -430,8 +433,15 @@ def report(path, xml_request, collection): in root.findall(_tag("D", "href"))) else: hreferences = (path,) + # TODO: handle other filters + # TODO: handle the nested comp-filters correctly + # Read rfc4791-9.7.1 for info + tag_filters = set( + element.get("name") for element + in root.findall(".//%s" % _tag("C", "comp-filter"))) else: hreferences = () + tag_filters = None # Writing answer multistatus = ET.Element(_tag("D", "multistatus")) @@ -454,6 +464,9 @@ def report(path, xml_request, collection): items = collection.components for item in items: + if tag_filters and item.tag not in tag_filters: + continue + response = ET.Element(_tag("D", "response")) multistatus.append(response)