Un-revert some lost commits

This commit is contained in:
Guillaume Ayoub 2012-08-08 16:37:18 +02:00
parent eee83bb49c
commit a17ad1b6a3
8 changed files with 35 additions and 51 deletions

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Radicale</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?>
<pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/Radicale</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project>

View File

@ -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

View File

@ -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

View File

@ -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" %

View File

@ -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

View File

@ -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",

View File

@ -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)