[CalendarServer-changes] [3044] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Sep 24 09:59:39 PDT 2008
Revision: 3044
http://trac.macosforge.org/projects/calendarserver/changeset/3044
Author: cdaboo at apple.com
Date: 2008-09-24 09:59:39 -0700 (Wed, 24 Sep 2008)
Log Message:
-----------
Better detection of "significant" organizer changes. This still needs more work.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/ical.py
CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py 2008-09-24 16:54:00 UTC (rev 3043)
+++ CalendarServer/trunk/twistedcaldav/ical.py 2008-09-24 16:59:39 UTC (rev 3044)
@@ -308,8 +308,10 @@
my_subcomponents = set(self.subcomponents())
for subcomponent in other.subcomponents():
- if subcomponent in my_subcomponents:
- my_subcomponents.remove(subcomponent)
+ for testcomponent in my_subcomponents:
+ if subcomponent == testcomponent:
+ my_subcomponents.remove(testcomponent)
+ break
else:
return False
if my_subcomponents:
@@ -1400,7 +1402,7 @@
if remove:
[component.removeProperty(p) for p in tuple(component.properties()) if p.name() in remove]
- def removeXProperties(self, keep_properties):
+ def removeXProperties(self, keep_properties=()):
"""
Remove all X- properties except the specified ones
"""
@@ -1434,6 +1436,28 @@
except KeyError:
pass
+ def removePropertyParametersByValue(self, property, paramvalues):
+ """
+ Remove all specified property parameters
+ """
+
+ assert self.name() == "VCALENDAR", "Not a calendar: %r" % (self,)
+
+ for component in self.subcomponents():
+ if component.name() == "VTIMEZONE":
+ continue
+ props = component.properties(property)
+ for prop in props:
+ for param, value in paramvalues:
+ try:
+ prop.params()[param].remove(value)
+ if len(prop.params()[param]) == 0:
+ del prop.params()[param]
+ except KeyError:
+ pass
+ except ValueError:
+ pass
+
def normalizePropertyValueLists(self, propname):
"""
Convert properties that have a list of values into single properties, to make it easier
@@ -1450,7 +1474,15 @@
component.removeProperty(prop)
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/icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py 2008-09-24 16:54:00 UTC (rev 3043)
+++ CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py 2008-09-24 16:59:39 UTC (rev 3044)
@@ -61,15 +61,23 @@
"SCHEDULE-STATUS",
)
+ removeAttendeeParametersByValue = (
+ ("PARTSTAT", "NEEDS-ACTION"),
+ )
+
# Do straight comparison without alarms
self.calendar1 = self.calendar1.duplicate()
self.calendar1.removeAlarms()
self.calendar1.filterProperties(remove=removeProperties)
+ self.calendar1.removeXProperties()
self.calendar1.removePropertyParameters("ATTENDEE", removeAttendeeParameters)
+ self.calendar1.removePropertyParametersByValue("ATTENDEE", removeAttendeeParametersByValue)
self.calendar2 = self.calendar2.duplicate()
self.calendar2.removeAlarms()
self.calendar2.filterProperties(remove=removeProperties)
+ self.calendar2.removeXProperties()
self.calendar2.removePropertyParameters("ATTENDEE", removeAttendeeParameters)
+ self.calendar2.removePropertyParametersByValue("ATTENDEE", removeAttendeeParametersByValue)
return self.calendar1 == self.calendar2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080924/edf7cda3/attachment.html
More information about the calendarserver-changes
mailing list