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

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 30 11:57:30 PDT 2012


Revision: 9214
          http://trac.macosforge.org/projects/calendarserver/changeset/9214
Author:   sagen at apple.com
Date:     2012-04-30 11:57:30 -0700 (Mon, 30 Apr 2012)
Log Message:
-----------
Begin expansion far in the past because there may be RDATEs earlier than the master DTSTART, and if we exclude those, the associated overridden instances will cause an InvalidOverriddenInstance.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/instance.py
    CalendarServer/trunk/twistedcaldav/test/test_icalendar.py

Modified: CalendarServer/trunk/twistedcaldav/instance.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/instance.py	2012-04-30 17:29:12 UTC (rev 9213)
+++ CalendarServer/trunk/twistedcaldav/instance.py	2012-04-30 18:57:30 UTC (rev 9214)
@@ -304,7 +304,11 @@
         if rrules is not None and rulestart is not None:
             # Do recurrence set expansion
             expanded = []
-            limited = rrules.expand(rulestart, PyCalendarPeriod(start, limit), expanded)
+            # Begin expansion far in the past because there may be RDATEs earlier
+            # than the master DTSTART, and if we exclude those, the associated
+            # overridden instances will cause an InvalidOverriddenInstance.
+            limited = rrules.expand(rulestart,
+                PyCalendarPeriod(PyCalendarDateTime(1900,1,1), limit), expanded)
             for startDate in expanded:
                 startDate = normalizeForIndex(startDate)
                 endDate = startDate + duration

Modified: CalendarServer/trunk/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_icalendar.py	2012-04-30 17:29:12 UTC (rev 9213)
+++ CalendarServer/trunk/twistedcaldav/test/test_icalendar.py	2012-04-30 18:57:30 UTC (rev 9214)
@@ -433,6 +433,17 @@
 SEQUENCE:4
 RECURRENCE-ID;TZID=America/Los_Angeles:20111215T143000
 END:VEVENT
+BEGIN:VEVENT
+CREATED:20111206T203543Z
+UID:5F7FF5FB-2253-4895-8BF1-76E8ED868B4C
+DTEND;TZID=America/Los_Angeles:20001214T163000
+TRANSP:OPAQUE
+SUMMARY:bogus instance
+DTSTART;TZID=America/Los_Angeles:20001214T153000
+DTSTAMP:20111206T203606Z
+SEQUENCE:4
+RECURRENCE-ID;TZID=America/Los_Angeles:20001215T143000
+END:VEVENT
 END:VCALENDAR
 """
         # Ensure it starts off invalid
@@ -451,6 +462,8 @@
         # Now it should pass without fixing
         calendar.validCalendarData(doFix=False, validateRecurrences=True)
 
+        # Verify expansion works, even for an RDATE prior to master DTSTART:
+        calendar.expandTimeRanges(PyCalendarDateTime(2100, 1, 1))
 
         # Test EXDATEs *prior* to master (as the result of client splitting a
         # a recurring event and copying *all* EXDATEs to new event):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120430/7b9bd1d7/attachment.html>


More information about the calendarserver-changes mailing list