[CalendarServer-changes] [10836] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 4 11:07:05 PST 2013
Revision: 10836
http://trac.calendarserver.org//changeset/10836
Author: cdaboo at apple.com
Date: 2013-03-04 11:07:05 -0800 (Mon, 04 Mar 2013)
Log Message:
-----------
Fix removal of undeclined overridden instance when no master exists.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/datafilters/hiddeninstance.py
CalendarServer/trunk/twistedcaldav/datafilters/test/test_hiddeninstances.py
CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
CalendarServer/trunk/twistedcaldav/scheduling/test/test_icaldiff.py
Modified: CalendarServer/trunk/twistedcaldav/datafilters/hiddeninstance.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/datafilters/hiddeninstance.py 2013-03-04 18:58:00 UTC (rev 10835)
+++ CalendarServer/trunk/twistedcaldav/datafilters/hiddeninstance.py 2013-03-04 19:07:05 UTC (rev 10836)
@@ -33,13 +33,11 @@
@param ical: iCalendar object
@type ical: L{Component} or C{str}
-
+
@return: L{Component} for the filtered calendar data
"""
-
+
master = ical.masterComponent()
- if master is None:
- return ical
for component in tuple(ical.subcomponents()):
if component.name() in ignoredComponents:
continue
@@ -49,15 +47,17 @@
if component.hasProperty(Component.HIDDEN_INSTANCE_PROPERTY):
rid = component.getRecurrenceIDUTC()
ical.removeComponent(component)
-
+
# Add EXDATE and try to preserve same timezone as DTSTART
- dtstart = master.getProperty("DTSTART")
- if dtstart is not None and not dtstart.value().isDateOnly() and dtstart.value().local():
- rid.adjustTimezone(dtstart.value().getTimezone())
- master.addProperty(Property("EXDATE", [rid,]))
-
+ if master is not None:
+ dtstart = master.getProperty("DTSTART")
+ if dtstart is not None and not dtstart.value().isDateOnly() and dtstart.value().local():
+ rid.adjustTimezone(dtstart.value().getTimezone())
+ master.addProperty(Property("EXDATE", [rid, ]))
+
return ical
-
+
+
def merge(self, icalnew, icalold):
"""
Private event merging does not happen
Modified: CalendarServer/trunk/twistedcaldav/datafilters/test/test_hiddeninstances.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/datafilters/test/test_hiddeninstances.py 2013-03-04 18:58:00 UTC (rev 10835)
+++ CalendarServer/trunk/twistedcaldav/datafilters/test/test_hiddeninstances.py 2013-03-04 19:07:05 UTC (rev 10836)
@@ -21,7 +21,7 @@
class HiddenInstanceFilterTest (twistedcaldav.test.util.TestCase):
def test_public_default(self):
-
+
data = (
(
"Nothing hidden, no recurrence",
@@ -378,7 +378,7 @@
""",
),
(
- "No master, one hidden - not really",
+ "No master, one hidden",
"""BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -415,21 +415,11 @@
ATTENDEE:mailto:user2 at example.com
ORGANIZER;CN=User 01:mailto:user1 at example.com
END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890
-RECURRENCE-ID:20080603T120000Z
-DTSTART:20080603T123000Z
-DTEND:20080601T133000Z
-ATTENDEE:mailto:user1 at example.com
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER;CN=User 01:mailto:user1 at example.com
-X-CALENDARSERVER-HIDDEN-INSTANCE:T
-END:VEVENT
END:VCALENDAR
""",
),
)
-
+
for title, test, result in data:
ics = Component.fromString(test.replace("\n", "\r\n"))
self.assertEqual(str(HiddenInstanceFilter().filter(ics)), result.replace("\n", "\r\n"), msg="Failed: %s" % (title,))
Modified: CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py 2013-03-04 18:58:00 UTC (rev 10835)
+++ CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py 2013-03-04 19:07:05 UTC (rev 10836)
@@ -339,11 +339,9 @@
changedRids.append(rid.getText() if rid else "")
# When a master component is present we keep the missing override in place but mark it as hidden.
- # When no master is present we remove the override,
- if exdatesnew is not None:
- overridden.replaceProperty(Property(Component.HIDDEN_INSTANCE_PROPERTY, "T"))
- else:
- returnCalendar.removeComponent(overridden)
+ # When no master is present we now do the same so we can track updates to the override correctly.
+ overridden.replaceProperty(Property(Component.HIDDEN_INSTANCE_PROPERTY, "T"))
+
else:
# We used to generate a 403 here - but instead we now ignore this error and let the server data
# override the client
Modified: CalendarServer/trunk/twistedcaldav/scheduling/test/test_icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/test/test_icaldiff.py 2013-03-04 18:58:00 UTC (rev 10835)
+++ CalendarServer/trunk/twistedcaldav/scheduling/test/test_icaldiff.py 2013-03-04 19:07:05 UTC (rev 10836)
@@ -2014,6 +2014,17 @@
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=DECLINED;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+TRANSP:TRANSPARENT
+X-CALENDARSERVER-HIDDEN-INSTANCE:T
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
RECURRENCE-ID:20080604T120000Z
DTSTART:20080604T130000Z
DTEND:20080604T140000Z
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130304/34c4d297/attachment.html>
More information about the calendarserver-changes
mailing list