[CalendarServer-changes] [13933] CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav /datastore/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 2 11:57:52 PDT 2014


Revision: 13933
          http://trac.calendarserver.org//changeset/13933
Author:   cdaboo at apple.com
Date:     2014-09-02 11:57:52 -0700 (Tue, 02 Sep 2014)
Log Message:
-----------
Make sure free busy updates properly when overridden instances are added/removed from an auto-accept attendee.

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/icaldiff.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_icaldiff.py

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/icaldiff.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/icaldiff.py	2014-09-02 18:57:01 UTC (rev 13932)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/icaldiff.py	2014-09-02 18:57:52 UTC (rev 13933)
@@ -725,16 +725,28 @@
 
         # Now verify that each additional component in oldset matches a derived component in newset
         for key in oldset - newset:
+            rid = key[2]
             oldcomponent = oldmap[key]
-            newcomponent = self.newcalendar.deriveInstance(key[2])
+            newcomponent = self.newcalendar.deriveInstance(rid)
             if newcomponent is None:
+                # For the non iTIP case we must report missing components on either side. Marking
+                # the DTSTART as changed is enough to trigger logic in the caller to treat this
+                # as a significant change.
+                if not isiTip:
+                    rids[rid.getText() if rid is not None else ""] = {"DTSTART": set()}
                 continue
             self._diffComponents(oldcomponent, newcomponent, rids, isiTip)
 
         # Now verify that each additional component in oldset matches a derived component in newset
         for key in newset - oldset:
-            oldcomponent = self.oldcalendar.deriveInstance(key[2])
+            rid = key[2]
+            oldcomponent = self.oldcalendar.deriveInstance(rid)
             if oldcomponent is None:
+                # For the non iTIP case we must report missing components on either side. Marking
+                # the DTSTART as changed is enough to trigger logic in the caller to treat this
+                # as a significant change.
+                if not isiTip:
+                    rids[rid.getText() if rid is not None else ""] = {"DTSTART": set()}
                 continue
             newcomponent = newmap[key]
             self._diffComponents(oldcomponent, newcomponent, rids, isiTip)

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_icaldiff.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_icaldiff.py	2014-09-02 18:57:01 UTC (rev 13932)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_icaldiff.py	2014-09-02 18:57:52 UTC (rev 13933)
@@ -4497,12 +4497,163 @@
             ),
         )
 
-        for description, calendar1, calendar2, rids in itertools.chain(data1, data2, data3,):
+        data4 = (
+            (
+                "#4.1 Override component removed",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080602T120000Z
+DTSTART:20080602T130000Z
+DTEND:20080602T140000Z
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR
+""",
+                {},
+            ),
+            (
+                "#4.2 Override component added",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+SUMMARY:Test
+END:VEVENT
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080602T120000Z
+DTSTART:20080602T130000Z
+DTEND:20080602T140000Z
+SUMMARY:Test
+END:VCALENDAR
+""",
+                {},
+            ),
+        )
+
+        data5 = (
+            (
+                "#5.1 Override component removed",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080602T120000Z
+DTSTART:20080602T130000Z
+DTEND:20080602T140000Z
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR
+""",
+                {"20080602T120000Z": {"DTSTART": set()}},
+            ),
+            (
+                "#5.2 Override component added",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+SUMMARY:Test
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080602T120000Z
+DTSTART:20080602T130000Z
+DTEND:20080602T140000Z
+SUMMARY:Test
+END:VEVENT
+END:VCALENDAR
+""",
+                {"20080602T120000Z": {"DTSTART": set()}},
+            ),
+        )
+
+        for description, calendar1, calendar2, rids in itertools.chain(data1, data2, data3, data4,):
             differ = iCalDiff(Component.fromString(calendar1), Component.fromString(calendar2), False)
             got_rids = differ.whatIsDifferent()
             self.assertEqual(got_rids, rids, msg="%s expected R-IDs: '%s', got: '%s'" % (description, rids, got_rids,))
 
+        for description, calendar1, calendar2, rids in itertools.chain(data5,):
+            differ = iCalDiff(Component.fromString(calendar1), Component.fromString(calendar2), False)
+            got_rids = differ.whatIsDifferent(isiTip=False)
+            self.assertEqual(got_rids, rids, msg="%s expected R-IDs: '%s', got: '%s'" % (description, rids, got_rids,))
 
+
     def test_organizer_smart_merge(self):
 
         data1 = (
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140902/e6af0eff/attachment.html>


More information about the calendarserver-changes mailing list