[CalendarServer-changes] [4272] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri May 15 09:37:17 PDT 2009


Revision: 4272
          http://trac.macosforge.org/projects/calendarserver/changeset/4272
Author:   cdaboo at apple.com
Date:     2009-05-15 09:37:16 -0700 (Fri, 15 May 2009)
Log Message:
-----------
Fix for recurrence expansion vs UTC during whatIsDifferent() implicit scheduling. Make sure RRULE truncation
gets rid of any existing RRULEs.

Modified Paths:
--------------
    CalendarServer/trunk/lib-patches/vobject/vobject.icalendar.patch
    CalendarServer/trunk/twistedcaldav/ical.py
    CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py

Modified: CalendarServer/trunk/lib-patches/vobject/vobject.icalendar.patch
===================================================================
--- CalendarServer/trunk/lib-patches/vobject/vobject.icalendar.patch	2009-05-15 16:34:52 UTC (rev 4271)
+++ CalendarServer/trunk/lib-patches/vobject/vobject.icalendar.patch	2009-05-15 16:37:16 UTC (rev 4272)
@@ -21,6 +21,15 @@
  
                          rule._until = until
                      
+@@ -473,7 +485,7 @@
+             untilSerialize = lambda x: dateTimeToString(x, True)
+ 
+         for name in DATESANDRULES:
+-            if hasattr(self.contents, name):
++            if name in self.contents:
+                 del self.contents[name]
+             setlist = getattr(rruleset, '_' + name)
+             if name in DATENAMES:
 @@ -1661,9 +1673,10 @@
                  else:
                      current.append(char)

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2009-05-15 16:34:52 UTC (rev 4271)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2009-05-15 16:37:16 UTC (rev 4272)
@@ -1848,7 +1848,7 @@
         Remove all X- properties except the specified ones
         """
 
-        if do_subcomponents:
+        if do_subcomponents and self.name() == "VCALENDAR":
             for component in self.subcomponents():
                 component.removeXProperties(keep_properties, remove_x_parameters, do_subcomponents=False)
         else:
@@ -1868,12 +1868,13 @@
         Remove all specified property parameters
         """
 
-        assert self.name() == "VCALENDAR", "Not a calendar: %r" % (self,)
-
-        for component in self.subcomponents():
-            if component.name() == "VTIMEZONE":
-                continue
-            props = component.properties(property)
+        if self.name() == "VCALENDAR":
+            for component in self.subcomponents():
+                if component.name() == "VTIMEZONE":
+                    continue
+                component.removePropertyParameters(property, params)
+        else:
+            props = self.properties(property)
             for prop in props:
                 for param in params:
                     try:
@@ -1886,12 +1887,13 @@
         Remove all specified property parameters
         """
 
-        assert self.name() == "VCALENDAR", "Not a calendar: %r" % (self,)
-
-        for component in self.subcomponents():
-            if component.name() == "VTIMEZONE":
-                continue
-            props = component.properties(property)
+        if self.name() == "VCALENDAR":
+            for component in self.subcomponents():
+                if component.name() == "VTIMEZONE":
+                    continue
+                component.removePropertyParametersByValue(property, paramvalues)
+        else:
+            props = self.properties(property)
             for prop in props:
                 for param, value in paramvalues:
                     try:
@@ -2006,33 +2008,38 @@
         to do comparisons between two ical objects.
         """
         
-        assert self.name() == "VCALENDAR", "Not a calendar: %r" % (self,)
-
-        for component in self.subcomponents():
-            if component.name() == "VTIMEZONE":
-                continue
-            for prop in tuple(component.properties(propname)):
+        if self.name() == "VCALENDAR":
+            for component in self.subcomponents():
+                if component.name() == "VTIMEZONE":
+                    continue
+                component.normalizePropertyValueLists(propname)
+        else:
+            for prop in tuple(self.properties(propname)):
                 if type(prop.value()) is list and len(prop.value()) > 1:
-                    component.removeProperty(prop)
+                    self.removeProperty(prop)
                     for value in prop.value():
-                        component.addProperty(Property(propname, [value,]))
+                        self.addProperty(Property(propname, [value,]))
 
     def normalizeAttachments(self):
         """
         Remove any ATTACH properties that relate to a dropbox.
         """
         
-        # Do to all sub-components
-        for component in self.subcomponents():
-            dropboxPrefix = component.propertyValue("X-APPLE-DROPBOX")
+        if self.name() == "VCALENDAR":
+            for component in self.subcomponents():
+                if component.name() == "VTIMEZONE":
+                    continue
+                component.normalizeAttachments()
+        else:
+            dropboxPrefix = self.propertyValue("X-APPLE-DROPBOX")
             if dropboxPrefix is None:
-                continue
-            for attachment in tuple(component.properties("ATTACH")):
+                return
+            for attachment in tuple(self.properties("ATTACH")):
                 valueType = attachment.paramValue("VALUE")
                 if valueType in (None, "URI"):
                     dataValue = attachment.value()
                     if dataValue.find(dropboxPrefix) != -1:
-                        component.removeProperty(attachment)
+                        self.removeProperty(attachment)
 
     def normalizeCalendarUserAddresses(self, lookupFunction):
         """

Modified: CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2009-05-15 16:34:52 UTC (rev 4271)
+++ CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2009-05-15 16:37:16 UTC (rev 4272)
@@ -604,10 +604,6 @@
         and PARTSTAT parameters that are different.
         """
 
-        # Do straight comparison without alarms
-        self.calendar1 = self._attendeeDuplicateAndNormalize(self.calendar1)
-        self.calendar2 = self._attendeeDuplicateAndNormalize(self.calendar2)
-
         # First get uid/rid map of components
         def mapComponents(calendar):
             map = {}
@@ -651,14 +647,14 @@
         
         return rids
 
-    def _attendeeDuplicateAndNormalize(self, calendar):
-        calendar = calendar.duplicate()
-        calendar.normalizePropertyValueLists("EXDATE")
-        calendar.removePropertyParameters("ORGANIZER", ("SCHEDULE-STATUS",))
-        calendar.normalizeAll()
-        calendar.normalizeAttachments()
-        iTipGenerator.prepareSchedulingMessage(calendar, reply=True)
-        return calendar
+    def _attendeeDuplicateAndNormalize(self, comp):
+        comp = comp.duplicate()
+        comp.normalizePropertyValueLists("EXDATE")
+        comp.removePropertyParameters("ORGANIZER", ("SCHEDULE-STATUS",))
+        comp.normalizeAll()
+        comp.normalizeAttachments()
+        iTipGenerator.prepareSchedulingMessage(comp, reply=True)
+        return comp
 
     def _diffComponents(self, comp1, comp2, rids):
         
@@ -668,6 +664,10 @@
             log.debug("Component names are different: '%s' and '%s'" % (comp1.name(), comp2.name()))
             return
         
+        # Duplicate then normalize for comparison
+        comp1 = self._attendeeDuplicateAndNormalize(comp1)
+        comp2 = self._attendeeDuplicateAndNormalize(comp2)
+
         # Diff all the properties
         comp1.transformAllFromNative()
         comp2.transformAllFromNative()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090515/88d54441/attachment-0001.html>


More information about the calendarserver-changes mailing list