Ignore CTag and remove useless workaround for empty calendars.

This commit is contained in:
Guillaume Ayoub 2010-04-13 00:31:00 +02:00
parent d4bdc36550
commit 57eef3c5ab
2 changed files with 0 additions and 23 deletions

View File

@ -136,7 +136,6 @@ class Calendar(object):
self.encoding = "utf-8" self.encoding = "utf-8"
self.owner = path.split("/")[0] self.owner = path.split("/")[0]
self.path = os.path.join(FOLDER, path.replace("/", os.path.sep)) self.path = os.path.join(FOLDER, path.replace("/", os.path.sep))
self.ctag = self.etag
@staticmethod @staticmethod
def _parse(text, item_types, name=None): def _parse(text, item_types, name=None):
@ -186,8 +185,6 @@ class Calendar(object):
If ``name`` is given, give this name to new items in ``text``. If ``name`` is given, give this name to new items in ``text``.
""" """
self.ctag = self.etag
items = self.items items = self.items
for new_item in self._parse(text, (Timezone, Event, Todo), name): for new_item in self._parse(text, (Timezone, Event, Todo), name):
@ -198,7 +195,6 @@ class Calendar(object):
def remove(self, name): def remove(self, name):
"""Remove object named ``name`` from calendar.""" """Remove object named ``name`` from calendar."""
self.ctag = self.etag
todos = [todo for todo in self.todos if todo.name != name] todos = [todo for todo in self.todos if todo.name != name]
events = [event for event in self.events if event.name != name] events = [event for event in self.events if event.name != name]
@ -207,7 +203,6 @@ class Calendar(object):
def replace(self, name, text): def replace(self, name, text):
"""Replace content by ``text`` in objet named ``name`` in calendar.""" """Replace content by ``text`` in objet named ``name`` in calendar."""
self.ctag = self.etag
self.remove(name) self.remove(name)
self.append(name, text) self.append(name, text)

View File

@ -128,11 +128,6 @@ def propfind(path, xml_request, calendar):
element.text = calendar.etag element.text = calendar.etag
prop.append(element) prop.append(element)
if _tag("CS", "getctag") in props:
element = ET.Element(_tag("CS", "getctag"))
element.text = calendar.ctag
prop.append(element)
status = ET.Element(_tag("D", "status")) status = ET.Element(_tag("D", "status"))
status.text = _response(200) status.text = _response(200)
propstat.append(status) propstat.append(status)
@ -186,19 +181,6 @@ def report(path, xml_request, calendar):
path = hreference path = hreference
items = calendar.events + calendar.todos items = calendar.events + calendar.todos
if not items:
# TODO: Read rfc4791-9.[6|10] to find a right answer
response = ET.Element(_tag("D", "response"))
multistatus.append(response)
href = ET.Element(_tag("D", "href"))
href.text = path
response.append(href)
status = ET.Element(_tag("D", "status"))
status.text = _response(204)
response.append(status)
for item in items: for item in items:
response = ET.Element(_tag("D", "response")) response = ET.Element(_tag("D", "response"))
multistatus.append(response) multistatus.append(response)