[CalendarServer-changes] [7603] CalendarServer/trunk/twistedcaldav/scheduling/implicit.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 17 19:12:44 PDT 2011


Revision: 7603
          http://trac.macosforge.org/projects/calendarserver/changeset/7603
Author:   cdaboo at apple.com
Date:     2011-06-17 19:12:44 -0700 (Fri, 17 Jun 2011)
Log Message:
-----------
Fix case where attendee is only in an instance that gets truncated away.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/scheduling/implicit.py

Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2011-06-18 02:11:37 UTC (rev 7602)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2011-06-18 02:12:44 UTC (rev 7603)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005-2010 Apple Inc. All rights reserved.
+# Copyright (c) 2005-2011 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -553,9 +553,45 @@
 
                 # Check to see whether a change to R-ID's happened
                 if rid == "":
-                    if "RRULE" in props or "DTSTART" in props and self.calendar.masterComponent().hasProperty("RRULE"):
+
+                    if "DTSTART" in props and self.calendar.masterComponent().hasProperty("RRULE"):
+                        # DTSTART change with RRULE present is always a reschedule
                         recurrence_reschedule = True
 
+                    elif "RRULE" in props:
+                        
+                        # Need to see if the RRULE change is a simple truncation or expansion - i.e. a change to
+                        # COUNT or UNTIL only. If so we don't need to treat this as a complete re-schedule.
+
+                        # Start off assuming they are different
+                        recurrence_reschedule = True
+
+                        # Get each RRULE (can be only one in the master)
+                        oldrrule = tuple(self.oldcalendar.masterComponent().properties("RRULE"))
+                        oldrrule = oldrrule[0].value() if len(oldrrule) else None
+                        newrrule = tuple(self.calendar.masterComponent().properties("RRULE"))
+                        newrrule = newrrule[0].value() if len(newrrule) else None
+                        
+                        if newrrule is not None and oldrrule is not None:
+                            
+                            # Normalize the rrules by removing COUNT/UNTIL and then compare
+                            oldrrule = oldrrule.duplicate()
+                            newrrule = newrrule.duplicate()
+                            
+                            oldrrule.setUseUntil(False)
+                            oldrrule.setUntil(None)
+                            oldrrule.setUseCount(False)
+                            oldrrule.setCount(0)
+ 
+                            newrrule.setUseUntil(False)
+                            newrrule.setUntil(None)
+                            newrrule.setUseCount(False)
+                            newrrule.setCount(0)
+                            
+                            # If they are equal we have a simple change - no overall reschedule
+                            if newrrule == oldrrule:
+                                recurrence_reschedule = False
+
             if checkOrganizerValue:
                 oldOrganizer = self.oldcalendar.getOrganizer()
                 newOrganizer = self.calendar.getOrganizer()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110617/44ea67cd/attachment.html>


More information about the calendarserver-changes mailing list