[CalendarServer-changes] [12783] CalendarServer/trunk/txdav/caldav/datastore/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Sun Mar 2 11:00:05 PST 2014


Revision: 12783
          http://trac.calendarserver.org//changeset/12783
Author:   cdaboo at apple.com
Date:     2014-03-02 11:00:05 -0800 (Sun, 02 Mar 2014)
Log Message:
-----------
Fix issue with splitting of events more than one year in the future.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/icalsplitter.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/icalsplitter.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/icalsplitter.py	2014-03-01 16:21:25 UTC (rev 12782)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/icalsplitter.py	2014-03-02 19:00:05 UTC (rev 12783)
@@ -63,7 +63,7 @@
         now.offsetDay(1)
         instances = ical.cacheExpandedTimeRanges(now)
         instances = sorted(instances.instances.values(), key=lambda x: x.start)
-        if instances[0].start >= self.past or instances[-1].start < self.now or len(instances) <= 1:
+        if len(instances) <= 1 or instances[0].start >= self.past or instances[-1].start < self.now:
             return False
 
         # Make sure there are some overridden components in the past - as splitting only makes sense when

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py	2014-03-01 16:21:25 UTC (rev 12782)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icalsplitter.py	2014-03-02 19:00:05 UTC (rev 12783)
@@ -68,6 +68,10 @@
             getattr(self, attrname_1).offsetSeconds(-1)
             self.subs[attrname_1] = getattr(self, attrname_1)
 
+        setattr(self, "now_future", self.now.duplicate())
+        getattr(self, "now_future").offsetYear(2)
+        self.subs["now_future"] = getattr(self, "now_future")
+
         self.patch(config, "MaxAllowedInstances", 500)
 
 
@@ -191,6 +195,24 @@
                 False,
             ),
             (
+                "#2.3 Small, more than a year in the future, simple recurring component",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:%(now_future)s
+DURATION:PT1H
+ORGANIZER:mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE:mailto:user2 at example.com
+RRULE:FREQ=DAILY
+END:VEVENT
+END:VCALENDAR
+""",
+                False,
+            ),
+            (
                 "#3.1 Small, old, recurring with future override",
                 """BEGIN:VCALENDAR
 VERSION:2.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140302/3bddb04c/attachment-0001.html>


More information about the calendarserver-changes mailing list