[CalendarServer-changes] [5215] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 24 21:58:40 PST 2010


Revision: 5215
          http://trac.macosforge.org/projects/calendarserver/changeset/5215
Author:   wsanchez at apple.com
Date:     2010-02-24 21:58:39 -0800 (Wed, 24 Feb 2010)
Log Message:
-----------
Less compareDateTime

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

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2010-02-25 05:38:15 UTC (rev 5214)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2010-02-25 05:58:39 UTC (rev 5215)
@@ -43,11 +43,11 @@
 from vobject.icalendar import TimezoneComponent, dateTimeToString, deltaToOffset, getTransition, stringToDate, stringToDateTime, stringToDurations, utc
 
 from twext.python.log import Logger
-from twext.python.datetime import timerange, asUTC, iCalendarString
+from twext.python.datetime import dateordatetime, timerange, asUTC, iCalendarString
 from twext.web2.stream import IStream
 from twext.web2.dav.util import allDataFromStream
 
-from twistedcaldav.dateops import compareDateTime, timeRangesOverlap, normalizeForIndex, differenceDateTime
+from twistedcaldav.dateops import timeRangesOverlap, normalizeForIndex, differenceDateTime
 from twistedcaldav.instance import InstanceList
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
 
@@ -484,7 +484,7 @@
             if component.name() == "VTIMEZONE":
                 continue
             rid = component.getRecurrenceIDUTC()
-            if rid and recurrence_id and compareDateTime(rid, recurrence_id) == 0:
+            if rid and recurrence_id and dateordatetime(rid) == recurrence_id:
                 return component
             elif rid is None and recurrence_id is None:
                 return component

Modified: CalendarServer/trunk/twistedcaldav/instance.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/instance.py	2010-02-25 05:38:15 UTC (rev 5214)
+++ CalendarServer/trunk/twistedcaldav/instance.py	2010-02-25 05:58:39 UTC (rev 5215)
@@ -20,10 +20,12 @@
 
 import datetime
 
-from twistedcaldav.dateops import normalizeForIndex, compareDateTime, differenceDateTime, periodEnd
-
 from vobject.icalendar import utc
 
+from twext.python.datetime import dateordatetime
+
+from twistedcaldav.dateops import normalizeForIndex, differenceDateTime, periodEnd
+
 # The maximum number of instances we will expand out to.
 # Raise a TooManyInstancesError exception if we exceed this.
 max_allowed_instances = 1000
@@ -279,7 +281,7 @@
 
     def _addMasterComponent(self, component, limit, start, end, duration):
         # Always add first instance if included in range.
-        if compareDateTime(start, limit) < 0:
+        if dateordatetime(start) < limit:
             # dateutils does not do all-day - so convert to datetime.datetime
             start = normalizeForIndex(start)
             end = normalizeForIndex(end)
@@ -299,7 +301,7 @@
         recur = component.getRRuleSet(True)
         if recur is not None:
             for startDate in recur:
-                if compareDateTime(startDate, limit) >= 0:
+                if dateordatetime(startDate) >= limit:
                     self.limit = limit
                     break
                 endDate = startDate + duration
@@ -319,12 +321,12 @@
         rid = normalizeForIndex(rid)
 
         # Make sure start is within the limit
-        if compareDateTime(start, limit) > 0 and compareDateTime(rid, limit) > 0:
+        if dateordatetime(start) > limit and dateordatetime(rid) > limit:
             return
 
         # Make sure override RECURRENCE-ID is a valid instance of the master
         if got_master:
-            if str(rid) not in self.instances and compareDateTime(rid, limit) <= 0:
+            if str(rid) not in self.instances and dateordatetime(rid) <= limit:
                 if self.ignoreInvalidInstances:
                     return
                 else:
@@ -373,7 +375,7 @@
         """
 
         start = component.getStartDateUTC()
-        if start is not None and (compareDateTime(start, limit) >= 0):
+        if start is not None and dateordatetime(start) >= limit:
             # If the free busy is beyond the end of the range we want, ignore it
             return
 
@@ -387,7 +389,7 @@
             assert isinstance(fb.value(), list), "FREEBUSY property does not contain a list of values: %r" % (fb,)
             for period in fb.value():
                 # Ignore if period starts after limit
-                if compareDateTime(period[0], limit) >= 0:
+                if dateordatetime(period[0]) >= limit:
                     continue
                 start = normalizeForIndex(period[0])
                 end = normalizeForIndex(periodEnd(period))
@@ -405,7 +407,7 @@
         """
 
         start = component.getStartDateUTC()
-        if start is not None and (compareDateTime(start, limit) >= 0):
+        if start is not None and dateordatetime(start) >= limit:
             # If the free busy is beyond the end of the range we want, ignore it
             return
         if start is None:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100224/26da5d93/attachment.html>


More information about the calendarserver-changes mailing list