[CalendarServer-changes] [3395] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Nov 19 08:26:39 PST 2008
Revision: 3395
http://trac.macosforge.org/projects/calendarserver/changeset/3395
Author: cdaboo at apple.com
Date: 2008-11-19 08:26:39 -0800 (Wed, 19 Nov 2008)
Log Message:
-----------
Handle RECURRENCE-ID parameters properly in derived instances. Make sure calendar user addresses
are normalized when doing comparisons.
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-11-18 23:35:59 UTC (rev 3394)
+++ CalendarServer/trunk/twistedcaldav/ical.py 2008-11-19 16:26:39 UTC (rev 3395)
@@ -118,6 +118,12 @@
"REQUEST-STATUS": (None, {"VALUE": "TEXT"}),
}
+# transformations to apply to property values
+normalizePropsValue = {
+ "ATTENDEE": normalizeCUAddr,
+ "ORGANIZER": normalizeCUAddr,
+}
+
class Property (object):
"""
iCalendar Property
@@ -953,7 +959,11 @@
if newcomp.hasProperty("DTEND"):
dtend = newcomp.getProperty("DTEND")
dtend.setValue(dtend.value() + offset)
- newcomp.addProperty(Property("RECURRENCE-ID", dtstart.value()))
+ try:
+ rid_params = {"X-VOBJ-ORIGINAL-TZID":dtstart.params()["X-VOBJ-ORIGINAL-TZID"]}
+ except KeyError:
+ rid_params = {}
+ newcomp.addProperty(Property("RECURRENCE-ID", dtstart.value(), params=rid_params))
return newcomp
@@ -1634,7 +1644,13 @@
if len(prop.params()) == 0:
if prop.value() == default_value:
self.removeProperty(prop)
+ continue
+ # Otherwise look for value normalization
+ normalize_function = normalizePropsValue.get(prop.name())
+ if normalize_function:
+ prop.setValue(normalize_function(prop.value()))
+
# Do to all sub-components too
for component in self.subcomponents():
component.normalizeAll()
Modified: CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py 2008-11-18 23:35:59 UTC (rev 3394)
+++ CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py 2008-11-19 16:26:39 UTC (rev 3395)
@@ -16,6 +16,7 @@
from twistedcaldav.ical import Component
from twistedcaldav.log import Logger
+from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
from twistedcaldav.scheduling.itip import iTipGenerator
from vobject.icalendar import dateTimeToString
@@ -84,7 +85,7 @@
"""
Merge changes to ATTENDEE properties in calendar1 into calendar2.
"""
- organizer = self.calendar2.masterComponent().propertyValue("ORGANIZER")
+ organizer = normalizeCUAddr(self.calendar2.masterComponent().propertyValue("ORGANIZER"))
self._doSmartMerge(organizer, True)
def _doSmartMerge(self, ignore_attendee, is_organizer):
@@ -187,13 +188,13 @@
# Create map of ATTENDEEs in old component
old_attendees = {}
for attendee in old_comp.properties("ATTENDEE"):
- value = attendee.value()
+ value = normalizeCUAddr(attendee.value())
if value == ignore_attendee_value:
continue
old_attendees[value] = attendee
for new_attendee in new_comp.properties("ATTENDEE"):
- value = new_attendee.value()
+ value = normalizeCUAddr(new_attendee.value())
old_attendee = old_attendees.get(value)
if old_attendee:
self._transferParameter(old_attendee, new_attendee, "PARTSTAT")
@@ -218,7 +219,7 @@
@type attendee: C{str}
"""
- self.attendee = attendee
+ self.attendee = normalizeCUAddr(attendee)
# If smart merge is needed we have to do this before trying the diff
if self.smart_merge:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081119/1fe6ca4c/attachment.html>
More information about the calendarserver-changes
mailing list