[CalendarServer-changes] [3117] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Sun Oct 5 22:44:57 PDT 2008
Revision: 3117
http://trac.macosforge.org/projects/calendarserver/changeset/3117
Author: cdaboo at apple.com
Date: 2008-10-05 22:44:55 -0700 (Sun, 05 Oct 2008)
Log Message:
-----------
Only send components that actually changed in requests.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/ical.py
CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
CalendarServer/trunk/twistedcaldav/scheduling/itip.py
Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py 2008-10-06 00:30:00 UTC (rev 3116)
+++ CalendarServer/trunk/twistedcaldav/ical.py 2008-10-06 05:44:55 UTC (rev 3117)
@@ -1362,7 +1362,29 @@
if not removed_master and master_component is not None:
for exdate in exdates:
master_component.addProperty(Property("EXDATE", (exdate,)))
+
+ def filterComponents(self, rids):
+ # If master is in rids do nothing
+ if not rids or "" in rids:
+ return True
+
+ assert self.name() == "VCALENDAR", "Not a calendar: %r" % (self,)
+
+ # Remove components not in the list
+ components = tuple(self.subcomponents())
+ remaining = len(components)
+ for component in components:
+ if component.name() == "VTIMEZONE":
+ remaining -= 1
+ continue
+ rid = component.getRecurrenceIDUTC()
+ if (dateTimeToString(rid) if rid else "") not in rids:
+ self.removeComponent(component)
+ remaining -= 1
+
+ return remaining != 0
+
def removeAllButOneAttendee(self, attendee):
"""
Remove all ATTENDEE properties except for the one specified.
@@ -1479,14 +1501,6 @@
for value in prop.value():
component.addProperty(Property(propname, [value,]))
- def sortByValue(self, component):
- """
- Sort all multi-occurring properties by value.
- """
-
- for prop in component.properties():
- pass
-
##
# Dates and date-times
##
Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py 2008-10-06 00:30:00 UTC (rev 3116)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py 2008-10-06 05:44:55 UTC (rev 3117)
@@ -239,7 +239,8 @@
self.oldcalendar = self.resource.iCalendar()
# Significant change
- if self.isChangeInsignificant():
+ no_change, self.changed_rids = self.isChangeInsignificant()
+ if no_change:
# Nothing to do
log.debug("Implicit - organizer '%s' is updating UID: '%s' but change is not significant" % (self.organizer, self.uid))
returnValue(None)
@@ -251,14 +252,19 @@
else:
log.debug("Implicit - organizer '%s' is creating UID: '%s'" % (self.organizer, self.uid))
self.oldcalendar = None
+ self.changed_rids = None
self.cancelledAttendees = ()
yield self.scheduleWithAttendees()
def isChangeInsignificant(self):
+ rids = None
differ = iCalDiff(self.oldcalendar, self.calendar)
- return differ.organizerDiff()
+ no_change = differ.organizerDiff()
+ if not no_change:
+ _ignore_props, rids = differ.whatIsDifferent()
+ return no_change, rids
def findRemovedAttendees(self):
"""
@@ -392,18 +398,18 @@
if attendee in self.except_attendees:
continue
- itipmsg = iTipGenerator.generateAttendeeRequest(self.calendar, (attendee,))
+ itipmsg = iTipGenerator.generateAttendeeRequest(self.calendar, (attendee,), self.changed_rids)
# Send scheduling message
+ if itipmsg is not None:
+ # This is a local CALDAV scheduling operation.
+ scheduler = CalDAVScheduler(self.request, self.resource)
+
+ # Do the PUT processing
+ log.info("Implicit REQUEST - organizer: '%s' to attendee: '%s', UID: '%s'" % (self.organizer, attendee, self.uid,))
+ response = (yield scheduler.doSchedulingViaPUT(self.originator, (attendee,), itipmsg, self.internal_request))
+ self.handleSchedulingResponse(response, True)
- # This is a local CALDAV scheduling operation.
- scheduler = CalDAVScheduler(self.request, self.resource)
-
- # Do the PUT processing
- log.info("Implicit REQUEST - organizer: '%s' to attendee: '%s', UID: '%s'" % (self.organizer, attendee, self.uid,))
- response = (yield scheduler.doSchedulingViaPUT(self.originator, (attendee,), itipmsg, self.internal_request))
- self.handleSchedulingResponse(response, True)
-
def handleSchedulingResponse(self, response, is_organizer):
# Map each recipient in the response to a status code
Modified: CalendarServer/trunk/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/itip.py 2008-10-06 00:30:00 UTC (rev 3116)
+++ CalendarServer/trunk/twistedcaldav/scheduling/itip.py 2008-10-06 05:44:55 UTC (rev 3117)
@@ -132,6 +132,7 @@
if component.propertyValue("TZID") not in tzids:
calendar.addComponent(component)
else:
+ component = component.duplicate()
iTipProcessing.transferItems(calendar, master_valarms, private_comments, component, remove_matched=True)
calendar.addComponent(component)
if config.Scheduling["CalDAV"]["OldDraftCompatability"] and recipient:
@@ -487,7 +488,7 @@
return itip
@staticmethod
- def generateAttendeeRequest(original, attendees):
+ def generateAttendeeRequest(original, attendees, filter_rids):
# Start with a copy of the original as we may have to modify bits of it
itip = original.duplicate()
@@ -500,11 +501,17 @@
# Now filter out components that do not contain every attendee
itip.attendeesView(attendees)
- # Strip out unwanted bits
- iTipGenerator.prepareSchedulingMessage(itip)
+ # Now filter out components except the ones specified
+ if itip.filterComponents(filter_rids):
- return itip
+ # Strip out unwanted bits
+ iTipGenerator.prepareSchedulingMessage(itip)
+
+ return itip
+ else:
+ return None
+
@staticmethod
def generateAttendeeReply(original, attendee, force_decline=False):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081005/2956b78c/attachment-0001.html
More information about the calendarserver-changes
mailing list