The owner field should be an URL. Fixes delays in iCal.
This commit is contained in:
parent
8bcdb5b1dc
commit
5b9180c295
@ -389,6 +389,13 @@ class Calendar(object):
|
||||
with open(props_path, 'w') as prop_file:
|
||||
json.dump(properties, prop_file)
|
||||
|
||||
@property
|
||||
def owner_url(self):
|
||||
if self.owner:
|
||||
return '/{}/'.format(self.owner).replace('//', '/')
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return '/{}/'.format(self.local_path).replace('//', '/')
|
||||
|
@ -214,18 +214,15 @@ def _propfind_response(path, item, props):
|
||||
for tag in props:
|
||||
element = ET.Element(tag)
|
||||
is404 = False
|
||||
if tag == _tag("D", "owner"):
|
||||
if item.owner:
|
||||
element.text = item.owner
|
||||
elif tag == _tag("D", "getcontenttype"):
|
||||
if tag == _tag("D", "getcontenttype"):
|
||||
element.text = "text/calendar"
|
||||
elif tag == _tag("D", "getetag"):
|
||||
element.text = item.etag
|
||||
elif tag == _tag("D", "principal-URL"):
|
||||
# TODO: use a real principal URL, read rfc3744-4.2 for info
|
||||
tag = ET.Element(_tag("D", "href"))
|
||||
if item.owner:
|
||||
tag.text = "/{}/".format(item.owner).replace("//", "/")
|
||||
if item.owner_url:
|
||||
tag.text = item.owner_url
|
||||
else:
|
||||
tag.text = path
|
||||
element.append(tag)
|
||||
@ -259,11 +256,13 @@ def _propfind_response(path, item, props):
|
||||
element.append(supported)
|
||||
elif is_calendar:
|
||||
if tag == _tag("D", "resourcetype"):
|
||||
if is_calendar and not item.is_principal:
|
||||
if not item.is_principal:
|
||||
tag = ET.Element(_tag("C", "calendar"))
|
||||
element.append(tag)
|
||||
tag = ET.Element(_tag("D", "collection"))
|
||||
element.append(tag)
|
||||
elif tag == _tag("D", "owner") and item.owner_url:
|
||||
element.text = item.owner_url
|
||||
elif tag == _tag("CS", "getctag"):
|
||||
element.text = item.etag
|
||||
else:
|
||||
@ -272,6 +271,10 @@ def _propfind_response(path, item, props):
|
||||
element.text = calendar_props[human_tag]
|
||||
else:
|
||||
is404 = True
|
||||
# not for calendars
|
||||
elif tag == _tag("D", "resourcetype"):
|
||||
tag = ET.Element(_tag("D", "collection"))
|
||||
element.append(tag)
|
||||
else:
|
||||
is404 = True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user