[CalendarServer-changes] [3789] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 3 10:54:42 PST 2009


Revision: 3789
          http://trac.macosforge.org/projects/calendarserver/changeset/3789
Author:   cdaboo at apple.com
Date:     2009-03-03 10:54:42 -0800 (Tue, 03 Mar 2009)
Log Message:
-----------
All-day overridden recurrence fix.

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

Modified: CalendarServer/trunk/run
===================================================================
--- CalendarServer/trunk/run	2009-03-03 18:53:15 UTC (rev 3788)
+++ CalendarServer/trunk/run	2009-03-03 18:54:42 UTC (rev 3789)
@@ -707,7 +707,7 @@
 
 caldavtester="${top}/CalDAVTester";
 
-svn_get "CalDAVTester" "${caldavtester}" "${svn_uri_base}/CalDAVTester/trunk" 3786;
+svn_get "CalDAVTester" "${caldavtester}" "${svn_uri_base}/CalDAVTester/trunk" 3788;
 
 #
 # PyFlakes

Modified: CalendarServer/trunk/twistedcaldav/dateops.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/dateops.py	2009-03-03 18:53:15 UTC (rev 3788)
+++ CalendarServer/trunk/twistedcaldav/dateops.py	2009-03-03 18:54:42 UTC (rev 3789)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2006-2008 Apple Inc. All rights reserved.
+# Copyright (c) 2006-2009 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.
@@ -33,8 +33,19 @@
 ]
 
 import datetime
-from vobject.icalendar import utc
+from vobject.icalendar import utc, dateTimeToString, dateToString
 
+def toString(dt):
+    """
+    Convert a L{datetime.date} or L{datetime.datetime} object to a string.
+    @param dt: a L{datetime.date} or L{datetime.datetime} object to normalize
+    @return: the converted date or datetime
+    """
+    if not isinstance(dt, datetime.date):
+        raise TypeError("%r is not a datetime.date instance" % (dt,))
+    
+    return dateTimeToString(dt) if isinstance(dt, datetime.datetime) else dateToString(dt)
+
 def normalizeStartEndDuration(dtstart, dtend=None, duration=None):
     """
     Given a DTSTART and DTEND or DURATION (or neither), return a normalized tuple of

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2009-03-03 18:53:15 UTC (rev 3788)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2009-03-03 18:54:42 UTC (rev 3789)
@@ -35,7 +35,7 @@
 from twisted.web2.dav.util import allDataFromStream
 from twisted.web2.stream import IStream
 from twistedcaldav.dateops import compareDateTime, normalizeToUTC, timeRangesOverlap,\
-    normalizeStartEndDuration
+    normalizeStartEndDuration, toString
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
 from twistedcaldav.instance import InstanceList
 from twistedcaldav.log import Logger
@@ -1580,7 +1580,7 @@
                 remaining -= 1
                 continue
             rid = component.getRecurrenceIDUTC()
-            if (dateTimeToString(rid) if rid else "") not in rids:
+            if (toString(rid) if rid else "") not in rids:
                 self.removeComponent(component)
                 remaining -= 1
                 

Modified: CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2009-03-03 18:53:15 UTC (rev 3788)
+++ CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2009-03-03 18:54:42 UTC (rev 3789)
@@ -14,13 +14,12 @@
 # limitations under the License.
 ##
 
-from twistedcaldav.dateops import normalizeToUTC
+from twistedcaldav.dateops import normalizeToUTC, toString
 from twistedcaldav.ical import Component, Property
 from twistedcaldav.log import Logger
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
 from twistedcaldav.scheduling.itip import iTipGenerator
 
-from vobject.icalendar import dateTimeToString
 from difflib import unified_diff
 
 """
@@ -665,7 +664,7 @@
         
         if addedChanges:
             rid = comp1.getRecurrenceIDUTC()
-            rids.add(dateTimeToString(rid) if rid is not None else "")
+            rids.add(toString(rid) if rid is not None else "")
 
     def _logDiffError(self, title):
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090303/ac90bf2b/attachment.html>


More information about the calendarserver-changes mailing list