[CalendarServer-changes] [14524] CalendarServer/branches/users/sagen/trashcan-5
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 6 15:57:26 PST 2015
Revision: 14524
http://trac.calendarserver.org//changeset/14524
Author: sagen at apple.com
Date: 2015-03-06 15:57:26 -0800 (Fri, 06 Mar 2015)
Log Message:
-----------
willSplit( ) needs to check non-recurring events for past/future
Modified Paths:
--------------
CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/caldavxml.py
CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/storebridge.py
CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/scheduling/icalsplitter.py
Modified: CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/caldavxml.py 2015-03-06 22:00:19 UTC (rev 14523)
+++ CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/caldavxml.py 2015-03-06 23:57:26 UTC (rev 14524)
@@ -1167,6 +1167,15 @@
@registerElement
+class Trash (CalDAVEmptyElement):
+ """
+ Denotes the resource type of a trash collection.
+ """
+ name = "trash"
+
+
+
+ at registerElement
class ScheduleResponse (CalDAVElement):
"""
The set of responses for a SCHEDULE method operation.
@@ -1417,3 +1426,4 @@
ResourceType.calendar = ResourceType(Collection(), Calendar())
ResourceType.scheduleInbox = ResourceType(Collection(), ScheduleInbox())
ResourceType.scheduleOutbox = ResourceType(Collection(), ScheduleOutbox())
+ResourceType.trash = ResourceType(Collection(), Trash())
Modified: CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/storebridge.py 2015-03-06 22:00:19 UTC (rev 14523)
+++ CalendarServer/branches/users/sagen/trashcan-5/twistedcaldav/storebridge.py 2015-03-06 23:57:26 UTC (rev 14524)
@@ -1100,6 +1100,8 @@
return customxml.ResourceType.sharedownercalendar
elif self.isShareeResource():
return customxml.ResourceType.sharedcalendar
+ elif self._newStoreObject.isTrash():
+ return customxml.ResourceType.trash
else:
return caldavxml.ResourceType.calendar
Modified: CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/scheduling/icalsplitter.py
===================================================================
--- CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/scheduling/icalsplitter.py 2015-03-06 22:00:19 UTC (rev 14523)
+++ CalendarServer/branches/users/sagen/trashcan-5/txdav/caldav/datastore/scheduling/icalsplitter.py 2015-03-06 23:57:26 UTC (rev 14524)
@@ -58,28 +58,26 @@
C{True} if a split is required
C{True} if event is fully in future
The second boolean's value is undefined if the first is True or
- the event is not recurring, or threshold != -1
+ threshold != -1
@rtype: C{tuple} of two C{bool}
"""
fullyInFuture = False
- # Must be recurring
- if not ical.isRecurring():
- return (False, False)
-
# Look for past/future (cacheExpandedTimeRanges will go one year in the future by default)
now = self.now.duplicate()
now.offsetDay(1)
+
+ # Check recurring
+ if not ical.isRecurring():
+ fullyInFuture = (ical.mainComponent().getStartDateUTC() >= now)
+ return (False, fullyInFuture)
+
instances = ical.cacheExpandedTimeRanges(now)
instances = sorted(instances.instances.values(), key=lambda x: x.start)
if len(instances) <= 1 or instances[0].start >= self.past or instances[-1].start < self.now:
# Event is either fully in past or in future
- if len(instances) == 0 or instances[0].start >= now:
- # fully in future
- fullyInFuture = True
- else:
- fullyInFuture = False
+ fullyInFuture = (len(instances) == 0 or instances[0].start >= now)
return (False, fullyInFuture)
if self.threshold != -1:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150306/b0f0761f/attachment.html>
More information about the calendarserver-changes
mailing list