[CalendarServer-changes] [13330] CalendarServer/trunk/txdav/caldav/datastore/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 18 12:32:26 PDT 2014


Revision: 13330
          http://trac.calendarserver.org//changeset/13330
Author:   cdaboo at apple.com
Date:     2014-04-18 12:32:26 -0700 (Fri, 18 Apr 2014)
Log Message:
-----------
Split related-id is now different from the event UID.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/icalsplitter.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/icalsplitter.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/icalsplitter.py	2014-04-18 19:31:05 UTC (rev 13329)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/icalsplitter.py	2014-04-18 19:32:26 UTC (rev 13330)
@@ -18,13 +18,17 @@
 
 from twistedcaldav.ical import Property
 
+import uuid
 
+
 class iCalSplitter(object):
     """
     Class that manages the "splitting" of large iCalendar objects into two pieces so that we can keep the overall
     size of individual calendar objects to a reasonable limit. This should only be used on Organizer events.
     """
 
+    uuid_namespace = uuid.UUID("1F50F5E1-3E10-4A85-A8B4-3906DA3B8C52")
+
     def __init__(self, threshold, past):
         """
         @param threshold: the size in bytes that will trigger a split
@@ -155,7 +159,7 @@
 
         # Relate them - add RELATED-TO;RELTYPE=RECURRENCE-SET if not already present
         if not icalOld.hasPropertyWithParameterMatch("RELATED-TO", "RELTYPE", "X-CALENDARSERVER-RECURRENCE-SET"):
-            property = Property("RELATED-TO", oldUID, params={"RELTYPE": "X-CALENDARSERVER-RECURRENCE-SET"})
+            property = Property("RELATED-TO", str(uuid.uuid5(self.uuid_namespace, oldUID)), params={"RELTYPE": "X-CALENDARSERVER-RECURRENCE-SET"})
             icalOld.addPropertyToAllComponents(property)
             icalNew.addPropertyToAllComponents(property)
 

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py	2014-04-18 19:31:05 UTC (rev 13329)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py	2014-04-18 19:32:26 UTC (rev 13330)
@@ -720,7 +720,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
 ATTENDEE:mailto:user1 at example.com
@@ -753,7 +753,7 @@
 RRULE:FREQ=DAILY;UNTIL=%(now_back14_1)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back25)s
 DTSTART:%(now_back25)s
 DURATION:PT1H
@@ -763,7 +763,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back24)s
 DTSTART:%(now_back24)s
 DURATION:PT1H
@@ -884,7 +884,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
 ATTENDEE:mailto:user1 at example.com
@@ -919,7 +919,7 @@
 RRULE:FREQ=DAILY;UNTIL=%(now_back14_1)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back25)s
 DTSTART:%(now_back25)s
 DURATION:PT1H
@@ -929,7 +929,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back24)s
 DTSTART:%(now_back24)s
 DURATION:PT1H
@@ -1041,7 +1041,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
 ATTENDEE:mailto:user1 at example.com
@@ -1075,7 +1075,7 @@
 RRULE:FREQ=DAILY;UNTIL=%(now_back13_1)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back25)s
 DTSTART:%(now_back25)s
 DURATION:PT1H
@@ -1085,7 +1085,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back24)s
 DTSTART:%(now_back24)s
 DURATION:PT1H
@@ -1220,7 +1220,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
 ATTENDEE:mailto:user1 at example.com
@@ -1254,7 +1254,7 @@
 RRULE:FREQ=DAILY;UNTIL=%(now_back14_1)s;INTERVAL=10
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back30)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
@@ -1264,7 +1264,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back20)s
 DTSTART:%(now_back20)s
 DURATION:PT1H
@@ -1421,7 +1421,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
 ATTENDEE:mailto:user1 at example.com
@@ -1454,7 +1454,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back30)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
@@ -1464,7 +1464,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back15)s
 DTSTART:%(now_back15)s
 DURATION:PT1H
@@ -1600,7 +1600,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
 ATTENDEE:mailto:user1 at example.com
@@ -1633,7 +1633,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back30)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
@@ -1643,7 +1643,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back15)s
 DTSTART:%(now_back15)s
 DURATION:PT1H
@@ -1805,7 +1805,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
 ATTENDEE:mailto:user1 at example.com
@@ -1838,7 +1838,7 @@
 RRULE:FREQ=DAILY;UNTIL=%(now_back14_1)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back25)s
 DTSTART:%(now_back25)s
 DURATION:PT1H
@@ -1848,7 +1848,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back24)s
 DTSTART:%(now_back24)s
 DURATION:PT1H
@@ -1858,7 +1858,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:X-CALENDARSERVER-PERUSER
-UID:%(relID)s
+UID:%(uid)s
 X-CALENDARSERVER-PERUSER-UID:user01
 BEGIN:X-CALENDARSERVER-PERINSTANCE
 TRANSP:OPAQUE
@@ -1980,7 +1980,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 DTSTART:%(now_back30)s
 DURATION:PT1H
 ATTENDEE:mailto:user1 at example.com
@@ -2013,7 +2013,7 @@
 RRULE:FREQ=DAILY;UNTIL=%(now_back14_1)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back25)s
 DTSTART:%(now_back25)s
 DURATION:PT1H
@@ -2023,7 +2023,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back24)s
 DTSTART:%(now_back24)s
 DURATION:PT1H
@@ -2079,7 +2079,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back25)s
 DTSTART:%(now_back25)s
 DURATION:PT1H
@@ -2125,7 +2125,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back25)s
 DTSTART:%(now_back25)s
 DURATION:PT1H
@@ -2135,7 +2135,7 @@
 RELATED-TO;RELTYPE=X-CALENDARSERVER-RECURRENCE-SET:%(relID)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_back24)s
 DTSTART:%(now_back24)s
 DURATION:PT1H
@@ -2212,7 +2212,8 @@
                 self.assertTrue(splitter.willSplit(ical), "Failed will split: %s" % (title,))
             icalOld, icalNew = splitter.split(ical)
             relsubs = dict(self.subs)
-            relsubs["relID"] = icalOld.resourceUID()
+            relsubs["uid"] = icalOld.resourceUID()
+            relsubs["relID"] = icalOld.mainComponent().propertyValue("RELATED-TO") if icalOld.mainComponent() else icalNew.mainComponent().propertyValue("RELATED-TO")
             self.assertEqual(str(icalNew).replace("\r\n ", ""), split_future.replace("\n", "\r\n") % relsubs, "Failed future: %s" % (title,))
             self.assertEqual(str(icalOld).replace("\r\n ", ""), split_past.replace("\n", "\r\n") % relsubs, "Failed past: %s" % (title,))
 
@@ -2333,7 +2334,7 @@
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 DTSTART:%(now)s
 DURATION:PT1H
 ATTENDEE:mailto:user1 at example.com
@@ -2366,7 +2367,7 @@
 RRULE:FREQ=DAILY;UNTIL=%(now_fwd11_1)s
 END:VEVENT
 BEGIN:VEVENT
-UID:%(relID)s
+UID:%(uid)s
 RECURRENCE-ID:%(now_fwd10)s
 DTSTART:%(now_fwd10)s
 DURATION:PT1H
@@ -2385,7 +2386,8 @@
             splitter = iCalSplitter(1024, 14)
             icalOld, icalNew = splitter.split(ical, rid=DateTime.parseText("%(now_fwd11)s" % self.subs))
             relsubs = dict(self.subs)
-            relsubs["relID"] = icalOld.resourceUID()
+            relsubs["uid"] = icalOld.resourceUID()
+            relsubs["relID"] = icalOld.mainComponent().propertyValue("RELATED-TO") if icalOld.mainComponent() else icalNew.mainComponent().propertyValue("RELATED-TO")
             self.assertEqual(str(icalNew).replace("\r\n ", ""), split_future.replace("\n", "\r\n") % relsubs, "Failed future: %s" % (title,))
             self.assertEqual(str(icalOld).replace("\r\n ", ""), split_past.replace("\n", "\r\n") % relsubs, "Failed past: %s" % (title,))
 
@@ -2397,7 +2399,8 @@
             splitter = iCalSplitter(1024, 14)
             icalOld, icalNew = splitter.split(ical, rid=splitter.whereSplit(ical, break_point=DateTime.parseText("%(now_fwd10_12h)s" % self.subs)))
             relsubs = dict(self.subs)
-            relsubs["relID"] = icalOld.resourceUID()
+            relsubs["uid"] = icalOld.resourceUID()
+            relsubs["relID"] = icalOld.mainComponent().propertyValue("RELATED-TO") if icalOld.mainComponent() else icalNew.mainComponent().propertyValue("RELATED-TO")
             self.assertEqual(str(icalNew).replace("\r\n ", ""), split_future.replace("\n", "\r\n") % relsubs, "Failed future: %s" % (title,))
             self.assertEqual(str(icalOld).replace("\r\n ", ""), split_past.replace("\n", "\r\n") % relsubs, "Failed past: %s" % (title,))
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140418/c744efcc/attachment-0001.html>


More information about the calendarserver-changes mailing list