[CalendarServer-changes] [11582] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 6 08:07:50 PDT 2013
Revision: 11582
http://trac.calendarserver.org//changeset/11582
Author: cdaboo at apple.com
Date: 2013-08-06 08:07:50 -0700 (Tue, 06 Aug 2013)
Log Message:
-----------
Make sure that organizer removing recurrence and master override works.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py
CalendarServer/trunk/twistedcaldav/ical.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
Modified: CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py 2013-08-06 15:07:03 UTC (rev 11581)
+++ CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py 2013-08-06 15:07:50 UTC (rev 11582)
@@ -312,7 +312,7 @@
if rid is None:
continue
derived = ical.deriveInstance(rid, newcomp=masterDerived)
- if derived and derived == subcomponent:
+ if derived is not None and derived == subcomponent:
ical.removeComponent(subcomponent)
Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py 2013-08-06 15:07:03 UTC (rev 11581)
+++ CalendarServer/trunk/twistedcaldav/ical.py 2013-08-06 15:07:50 UTC (rev 11582)
@@ -1446,6 +1446,10 @@
currently marked as an EXDATE in the existing master, allow an option whereby the override
is added as STATUS:CANCELLED and the EXDATE removed.
+ IMPORTANT: all callers of this method MUST check the return value for None. Never assume that
+ a valid instance will be derived - no matter how much you think you understand iCalendar recurrence.
+ There is always some new thing that will surprise you.
+
@param rid: recurrence-id value
@type rid: L{PyCalendarDateTime} or C{str}
@param allowCancelled: whether to allow a STATUS:CANCELLED override
@@ -1453,7 +1457,7 @@
@param allowExcluded: whether to derive an instance for an existing EXDATE
@type allowExcluded: C{bool}
- @return: L{Component} for newly derived instance, or None if not valid override
+ @return: L{Component} for newly derived instance, or C{None} if not a valid override
"""
if allowCancelled and newcomp is not None:
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py 2013-08-06 15:07:03 UTC (rev 11581)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py 2013-08-06 15:07:50 UTC (rev 11582)
@@ -124,7 +124,7 @@
# Determine whether the instance is still valid in the new calendar
new_component = self.newcalendar.deriveInstance(rid)
- if new_component:
+ if new_component is not None:
# Derive a new instance from the new calendar and transfer attendee status
self.newcalendar.addComponent(new_component)
self._tryComponentMerge(old_component, new_component, ignore_attendee, is_organizer)
@@ -153,7 +153,7 @@
# Try to derive a new instance in the client and transfer attendee status
old_component = self.oldcalendar.deriveInstance(rid)
- if old_component:
+ if old_component is not None:
self.oldcalendar.addComponent(old_component)
self._tryComponentMerge(old_component, new_component, ignore_attendee, is_organizer)
else:
@@ -424,7 +424,7 @@
overridden = returnCalendar.overriddenComponent(decline)
if not overridden:
overridden = returnCalendar.deriveInstance(decline)
- if overridden:
+ if overridden is not None:
if self._attendeeDecline(overridden):
changeCausesReply = True
changedRids.append(decline.getText() if decline else "")
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py 2013-08-06 15:07:03 UTC (rev 11581)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py 2013-08-06 15:07:50 UTC (rev 11582)
@@ -572,7 +572,8 @@
comp = self.calendar.overriddenComponent(rid)
if comp is None:
comp = self.calendar.deriveInstance(rid)
- self.calendar.addComponent(comp)
+ if comp is not None:
+ self.calendar.addComponent(comp)
for attendee in comp.getAllAttendeeProperties():
if attendee.hasParameter("PARTSTAT"):
@@ -856,6 +857,8 @@
# Compare the old one to a derived instance, and if there is a change
# add the derived instance to the new data
newcomp = self.calendar.deriveInstance(rid)
+ if newcomp is None:
+ continue
changed = self.compareAttendeePartstats(
self.oldcalendar.overriddenComponent(rid),
newcomp,
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py 2013-08-06 15:07:03 UTC (rev 11581)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/itip.py 2013-08-06 15:07:50 UTC (rev 11582)
@@ -179,7 +179,7 @@
allowCancelled = component.propertyValue("STATUS") == "CANCELLED"
hidden = component.hasProperty(Component.HIDDEN_INSTANCE_PROPERTY)
new_component = new_calendar.deriveInstance(rid, allowCancelled=allowCancelled and not hidden)
- if new_component:
+ if new_component is not None:
new_calendar.addComponent(new_component)
iTipProcessing.transferItems(calendar, new_component, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient)
if hidden:
@@ -298,7 +298,7 @@
else:
# Derive a new component and cancel it.
overridden = calendar.deriveInstance(rid)
- if overridden:
+ if overridden is not None:
overridden.replaceProperty(Property("STATUS", "CANCELLED"))
calendar.addComponent(overridden)
newseq = component.propertyValue("SEQUENCE")
@@ -376,7 +376,7 @@
# Attendee is overriding an instance themselves - we need to create a derived one
# for the Organizer
match_component = calendar.deriveInstance(rid)
- if match_component:
+ if match_component is not None:
calendar.addComponent(match_component)
else:
log.error("Ignoring instance: %s in iTIP REPLY for: %s" % (rid, itip_message.resourceUID()))
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2013-08-06 15:07:03 UTC (rev 11581)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2013-08-06 15:07:50 UTC (rev 11582)
@@ -936,7 +936,7 @@
# Derive a new overridden component and change partstat. We also need to make sure we restore any RSVP
# value that may have been overwritten by any change to the master itself.
derived = calendar.deriveInstance(instance.rid)
- if derived:
+ if derived is not None:
attendee = derived.getAttendeeProperty(cuas)
if attendee:
if instance.partstat == "NEEDS-ACTION" and instance.active:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130806/b13ddf72/attachment.html>
More information about the calendarserver-changes
mailing list