Add support for iCal (closes #252)

This commit is contained in:
Rémi Hainaud 2011-04-28 18:36:33 +02:00
parent c1da6872dd
commit 474113454b
2 changed files with 9 additions and 4 deletions

View File

@ -312,7 +312,8 @@ class CalendarHTTPHandler(server.BaseHTTPRequestHandler):
@log_request_content @log_request_content
def do_PROPPATCH(self): def do_PROPPATCH(self):
"""Manage PROPPATCH request.""" """Manage PROPPATCH request."""
self._answer = xmlutils.proppatch() self._answer = xmlutils.proppatch(
self.path, self._content, self._calendar)
self.send_response(client.MULTI_STATUS) self.send_response(client.MULTI_STATUS)
self.send_header("DAV", "1, calendar-access") self.send_header("DAV", "1, calendar-access")

View File

@ -187,10 +187,14 @@ def proppatch(path, xml_request, calendar):
""" """
# Reading request # Reading request
root = ET.fromstring(xml_request) root = ET.fromstring(xml_request)
props = []
prop_element = root.find(_tag("D", "prop")) for action in ("set", "remove"):
action_element = root.find(_tag("D", action))
if action_element:
prop_element = action_element.find(_tag("D", "prop"))
prop_list = prop_element.getchildren() prop_list = prop_element.getchildren()
props = [prop.tag for prop in prop_list] props.extend(prop.tag for prop in prop_list)
# Writing answer # Writing answer
multistatus = ET.Element(_tag("D", "multistatus")) multistatus = ET.Element(_tag("D", "multistatus"))