[CalendarServer-changes] [3404] CalendarServer/trunk/twistedcaldav/ical.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 21 19:41:24 PST 2008


Revision: 3404
          http://trac.macosforge.org/projects/calendarserver/changeset/3404
Author:   cdaboo at apple.com
Date:     2008-11-21 19:41:23 -0800 (Fri, 21 Nov 2008)
Log Message:
-----------
Make sure a calendar object resource cannot have two components with the same RECURRENCE-ID.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/ical.py

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2008-11-20 19:46:13 UTC (rev 3403)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2008-11-22 03:41:23 UTC (rev 3404)
@@ -1041,11 +1041,12 @@
         # Must not contain more than one type of iCalendar component, except for
         # the required timezone components, and component UIDs must match
         #
-        ctype         = None
-        component_id  = None
-        timezone_refs = set()
-        timezones     = set()
-        got_master    = False
+        ctype          = None
+        component_id   = None
+        component_rids = set()
+        timezone_refs  = set()
+        timezones      = set()
+        got_master     = False
         
         for subcomponent in self.subcomponents():
             # Disallowed in CalDAV-Access-08, section 4.1
@@ -1077,11 +1078,18 @@
                                          "(%s and %s found)" % (component_id, subcomponent.propertyValue("UID")))
                     elif subcomponent.propertyValue("Recurrence-ID") is None:
                         if got_master:
-                            raise ValueError("Calendar resources may not contain components with the same UIDs and no Recurrence-IDs" +
+                            raise ValueError("Calendar resources may not contain components with the same UIDs and no Recurrence-IDs " +
                                              "(%s and %s found)" % (component_id, subcomponent.propertyValue("UID")))
                         else:
                             got_master = True
         
+                rid = subcomponent.getRecurrenceIDUTC()
+                if rid in component_rids:
+                    raise ValueError("Calendar resources may not contain components with the same Recurrence-IDs " +
+                                     "(%s)" % (rid,))
+                else:
+                    component_rids.add(rid)
+
                 timezone_refs.update(subcomponent.timezoneIDs())
         
         #
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081121/22ace29a/attachment.html>


More information about the calendarserver-changes mailing list