Add getetag and getcontenttype support for propfind requests (Sunbird 1.0 ready).

This commit is contained in:
Guillaume Ayoub 2009-12-09 12:56:03 +01:00
parent 41741ba989
commit 6545bc8273
2 changed files with 14 additions and 0 deletions

View File

@ -60,6 +60,10 @@ class Calendar(object):
"""Return unicode calendar from the calendar.""" """Return unicode calendar from the calendar."""
return unicode(support.read(self.cal), self.encoding) return unicode(support.read(self.cal), self.encoding)
def etag(self):
"""Return etag from calendar."""
return hash_tag(self.vcalendar())
class Event(object): class Event(object):
"""Internal event class.""" """Internal event class."""
def __init__(self, vcalendar): def __init__(self, vcalendar):

View File

@ -105,6 +105,16 @@ def propfind(xml_request, calendar, url):
owner.text = calendar.owner owner.text = calendar.owner
prop.append(owner) prop.append(owner)
if _tag("D", "getcontenttype") in properties:
getcontenttype = ET.Element(_tag("D", "getcontenttype"))
getcontenttype.text = "text/calendar"
prop.append(getcontenttype)
if _tag("D", "getetag") in properties:
getetag = ET.Element(_tag("D", "getetag"))
getetag.text = calendar.etag()
prop.append(getetag)
if _tag("CS", "getctag") in properties: if _tag("CS", "getctag") in properties:
getctag = ET.Element(_tag("CS", "getctag")) getctag = ET.Element(_tag("CS", "getctag"))
getctag.text = calendar.ctag getctag.text = calendar.ctag