Fix support of recurring events

This commit is contained in:
Guillaume Ayoub 2016-07-07 17:49:56 +02:00
parent d7f41203f5
commit 8c225f019c
3 changed files with 26 additions and 1 deletions

View File

@ -527,7 +527,8 @@ class Collection(BaseCollection):
for item in items:
for content in ("vevent", "vtodo", "vjournal"):
if content in item.contents:
collection.add(getattr(item, content))
for item_part in getattr(item, "%s_list" % content):
collection.add(item_part)
break
return collection.serialize()
elif self.get_meta("tag") == "VADDRESSBOOK":

View File

@ -28,5 +28,15 @@ SUMMARY:Event2
DTSTART;TZID=Europe/Paris:20130902T180000
DTEND;TZID=Europe/Paris:20130902T190000
RRULE:FREQ=WEEKLY
SEQUENCE:1
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=Europe/Paris:20130910T170000
DTEND;TZID=Europe/Paris:20130910T180000
DTSTAMP:20140902T150158Z
SUMMARY:Event2
UID:event2
RECURRENCE-ID;TZID=Europe/Paris:20130909T180000
SEQUENCE:2
END:VEVENT
END:VCALENDAR

View File

@ -97,6 +97,20 @@ class BaseRequests:
status, headers, answer = self.request("GET", "/calendar.ics/")
assert "VEVENT" not in answer
def test_multiple_events_with_same_uid(self):
"""Add two events with the same UID."""
self.request("MKCOL", "/calendar.ics/")
self.request("PUT", "/calendar.ics/", get_file_content("event2.ics"))
status, headers, answer = self.request(
"REPORT", "/calendar.ics/",
"""<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:prop xmlns:D="DAV:"><D:getetag/></D:prop>
</C:calendar-query>""")
assert answer.count("<getetag>") == 1
status, headers, answer = self.request("GET", "/calendar.ics/")
assert answer.count("BEGIN:VEVENT") == 2
def _test_filter(self, filters, kind="event", items=1):
filters_text = "".join(
"<C:filter>%s</C:filter>" % filter_ for filter_ in filters)