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] [FORMAT]
# Maximum number of characters on a single line. # Maximum number of characters on a single line.
max-line-length=80 max-line-length=79
# Maximum number of lines in a module # Maximum number of lines in a module
max-module-lines=1000 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 # Check whether the group exists
try: try:
members = grp.getgrnam(GROUP_MEMBERSHIP) members = grp.getgrnam(GROUP_MEMBERSHIP).gr_mem
except KeyError: except KeyError:
log.LOGGER.debug( log.LOGGER.debug(
"The PAM membership required group (%s) doesn't exist" % "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 # Address, HOME, GID, and either UID or USERNAME are mandatory in resposne
# see http://www.courier-mta.org/authlib/README_authlib.html#authpipeproto # see http://www.courier-mta.org/authlib/README_authlib.html#authpipeproto
for line in data.split(): for line in data.split():
if 'GID' in line: if "GID" in line:
return True return True
# default is reject # default is reject

View File

@ -53,8 +53,10 @@ INITIAL_CONFIG = {
"type": "None", "type": "None",
"public_users": "public", "public_users": "public",
"private_users": "private", "private_users": "private",
"httpasswd_filename": "/etc/radicale/users", "htpasswd_filename": "/etc/radicale/users",
"httpasswd_encryption": "crypt", "htpasswd_encryption": "crypt",
"imap_auth_host_name": "localhost",
"imap_auth_host_port": "143",
"ldap_url": "ldap://localhost:389/", "ldap_url": "ldap://localhost:389/",
"ldap_base": "ou=users,dc=example,dc=com", "ldap_base": "ou=users,dc=example,dc=com",
"ldap_attribute": "uid", "ldap_attribute": "uid",
@ -66,10 +68,10 @@ INITIAL_CONFIG = {
"courier_socket": ""}, "courier_socket": ""},
"storage": { "storage": {
"type": "filesystem", "type": "filesystem",
"filesystem_folder": "filesystem_folder": os.path.expanduser(
os.path.expanduser("~/.config/radicale/collections"), "~/.config/radicale/collections"),
"git_folder": "git_folder": os.path.expanduser(
os.path.expanduser("~/.config/radicale/collections")}, "~/.config/radicale/collections")},
"logging": { "logging": {
"config": "/etc/radicale/logging", "config": "/etc/radicale/logging",
"debug": "False", "debug": "False",

View File

@ -240,11 +240,10 @@ def _propfind_response(path, item, props, user):
tag = ET.Element(_tag("D", "href")) tag = ET.Element(_tag("D", "href"))
tag.text = path tag.text = path
element.append(tag) element.append(tag)
elif tag in ( elif tag in (_tag("D", "principal-collection-set"),
_tag("D", "principal-collection-set"), _tag("C", "calendar-user-address-set"),
_tag("C", "calendar-user-address-set"), _tag("CR", "addressbook-home-set"),
_tag("CR", "addressbook-home-set"), _tag("C", "calendar-home-set")):
_tag("C", "calendar-home-set")):
tag = ET.Element(_tag("D", "href")) tag = ET.Element(_tag("D", "href"))
tag.text = path tag.text = path
element.append(tag) element.append(tag)
@ -284,12 +283,14 @@ def _propfind_response(path, item, props, user):
if item.is_principal: if item.is_principal:
tag = ET.Element(_tag("D", "principal")) tag = ET.Element(_tag("D", "principal"))
element.append(tag) element.append(tag)
if item.is_leaf(item.path): if item.is_leaf(item.path) or (
tag = ET.Element(_tag("C", item.resource_type)) not item.exists and item.resource_type):
element.append(tag) # 2nd case happens when the collection is not stored yet,
if not item.exists and item.resource_type: # but the resource type is guessed
# Collection not stored yet, but guessed resource type if item.resource_type == "addressbook":
tag = ET.Element(_tag("C", item.resource_type)) tag = ET.Element(_tag("CR", item.resource_type))
else:
tag = ET.Element(_tag("C", item.resource_type))
element.append(tag) element.append(tag)
tag = ET.Element(_tag("D", "collection")) tag = ET.Element(_tag("D", "collection"))
element.append(tag) element.append(tag)
@ -300,6 +301,8 @@ def _propfind_response(path, item, props, user):
elif tag == _tag("C", "calendar-timezone"): elif tag == _tag("C", "calendar-timezone"):
element.text = ical.serialize( element.text = ical.serialize(
item.tag, item.headers, item.timezones) item.tag, item.headers, item.timezones)
elif tag == _tag("D", "displayname"):
element.text = item.name
else: else:
human_tag = _tag_from_clark(tag) human_tag = _tag_from_clark(tag)
if human_tag in collection_props: if human_tag in collection_props:
@ -430,8 +433,15 @@ def report(path, xml_request, collection):
in root.findall(_tag("D", "href"))) in root.findall(_tag("D", "href")))
else: else:
hreferences = (path,) 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: else:
hreferences = () hreferences = ()
tag_filters = None
# Writing answer # Writing answer
multistatus = ET.Element(_tag("D", "multistatus")) multistatus = ET.Element(_tag("D", "multistatus"))
@ -454,6 +464,9 @@ def report(path, xml_request, collection):
items = collection.components items = collection.components
for item in items: for item in items:
if tag_filters and item.tag not in tag_filters:
continue
response = ET.Element(_tag("D", "response")) response = ET.Element(_tag("D", "response"))
multistatus.append(response) multistatus.append(response)