explicit component content-types for iCal

This commit is contained in:
Lukasz Langa 2011-06-01 16:22:36 +02:00
parent 710b518b0f
commit 31edc1b03d

View File

@ -214,9 +214,7 @@ def _propfind_response(path, item, props):
for tag in props: for tag in props:
element = ET.Element(tag) element = ET.Element(tag)
is404 = False is404 = False
if tag == _tag("D", "getcontenttype"): if tag == _tag("D", "getetag"):
element.text = "text/calendar"
elif tag == _tag("D", "getetag"):
element.text = item.etag element.text = item.etag
elif tag == _tag("D", "principal-URL"): elif tag == _tag("D", "principal-URL"):
# TODO: use a real principal URL, read rfc3744-4.2 for info # TODO: use a real principal URL, read rfc3744-4.2 for info
@ -255,7 +253,9 @@ def _propfind_response(path, item, props):
supported.append(report_tag) supported.append(report_tag)
element.append(supported) element.append(supported)
elif is_calendar: elif is_calendar:
if tag == _tag("D", "resourcetype"): if tag == _tag("D", "getcontenttype"):
element.text = "text/calendar"
elif tag == _tag("D", "resourcetype"):
if not item.is_principal: if not item.is_principal:
tag = ET.Element(_tag("C", "calendar")) tag = ET.Element(_tag("C", "calendar"))
element.append(tag) element.append(tag)
@ -272,9 +272,9 @@ def _propfind_response(path, item, props):
else: else:
is404 = True is404 = True
# not for calendars # not for calendars
elif tag == _tag("D", "resourcetype"): elif tag == _tag("D", "getcontenttype"):
tag = ET.Element(_tag("D", "collection")) element.text = \
element.append(tag) "text/calendar; component={}".format(item.tag.lower())
else: else:
is404 = True is404 = True