Use the right namespace for adressbook tags

This commit is contained in:
Guillaume Ayoub 2012-06-28 11:28:42 +02:00
parent cff6c2b43b
commit ea94ec919e

View File

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