[CalendarServer-changes] [3796] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Mar 5 08:58:37 PST 2009


Revision: 3796
          http://trac.macosforge.org/projects/calendarserver/changeset/3796
Author:   cdaboo at apple.com
Date:     2009-03-05 08:58:37 -0800 (Thu, 05 Mar 2009)
Log Message:
-----------
Properly handle adding an overridden instance on the other side of a DST shift (old code
triggered a datetime.datetime bug).

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

Modified: CalendarServer/trunk/run
===================================================================
--- CalendarServer/trunk/run	2009-03-05 16:55:46 UTC (rev 3795)
+++ CalendarServer/trunk/run	2009-03-05 16:58:37 UTC (rev 3796)
@@ -707,7 +707,7 @@
 
 caldavtester="${top}/CalDAVTester";
 
-svn_get "CalDAVTester" "${caldavtester}" "${svn_uri_base}/CalDAVTester/trunk" 3791;
+svn_get "CalDAVTester" "${caldavtester}" "${svn_uri_base}/CalDAVTester/trunk" 3795;
 
 #
 # PyFlakes

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2009-03-05 16:55:46 UTC (rev 3795)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2009-03-05 16:58:37 UTC (rev 3796)
@@ -954,13 +954,21 @@
             if property.name() in ["RRULE", "RDATE", "EXRULE", "EXDATE", "RECURRENCE-ID"]:
                 newcomp.removeProperty(property)
         
-        # Adjust times
-        offset = rid - newcomp.getStartDateUTC()
+        # New DTSTART is the RECURRENCE-ID we are deriving but adjusted to the
+        # original DTSTART's localtime
         dtstart = newcomp.getProperty("DTSTART")
-        dtstart.setValue(dtstart.value() + offset)
         if newcomp.hasProperty("DTEND"):
             dtend = newcomp.getProperty("DTEND")
-            dtend.setValue(dtend.value() + offset)
+            oldduration = dtend.value() - dtstart.value()
+            
+        newdtstartValue = rid
+        if isinstance(newdtstartValue, datetime.datetime):
+            if dtstart.value().tzinfo:
+                newdtstartValue = newdtstartValue.astimezone(dtstart.value().tzinfo)
+        dtstart.setValue(newdtstartValue)
+        if newcomp.hasProperty("DTEND"):
+            dtend.setValue(newdtstartValue + oldduration)
+
         try:
             rid_params = {"X-VOBJ-ORIGINAL-TZID":dtstart.params()["X-VOBJ-ORIGINAL-TZID"]}
         except KeyError:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090305/df3d9310/attachment.html>


More information about the calendarserver-changes mailing list