[CalendarServer-changes] [13956] CalendarServer/branches/release/CalendarServer-5.3-dev
source_changes at macosforge.org
source_changes at macosforge.org
Thu Sep 11 14:13:49 PDT 2014
Revision: 13956
http://trac.calendarserver.org//changeset/13956
Author: cdaboo at apple.com
Date: 2014-09-11 14:13:49 -0700 (Thu, 11 Sep 2014)
Log Message:
-----------
Proper EXDATE removal after attendee re-invited to overridden instance.
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/ical.py
CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/test/test_icalendar.py
CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/itip.py
CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py
CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_itip.py
Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/ical.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/ical.py 2014-09-11 21:12:30 UTC (rev 13955)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/ical.py 2014-09-11 21:13:49 UTC (rev 13956)
@@ -1639,6 +1639,37 @@
return rid in new_rids
+ def addExdate(self, exdate):
+ """
+ Add an EXDATE to a master recurring component and ensure the value type, TZID
+ etc match the DTSTART of the master. This method assumes that L{self} is the
+ master component - no checking of that will be done.
+
+ @param exdate: the exdate to add
+ @type exdate: L{DateTime}
+ """
+ dtstart = self.getProperty("DTSTART")
+ if dtstart is not None and not dtstart.value().isDateOnly() and dtstart.value().local():
+ exdate.adjustTimezone(dtstart.value().getTimezone())
+ self.addProperty(Property("EXDATE", [exdate, ]))
+
+
+ def removeExdate(self, exdate):
+ """
+ Remove an EXDATE from a master recurring component if present. If not present,
+ do nothing. This assumes L{self} is the master component
+
+ @param exdate: the exdate to add
+ @type exdate: L{DateTime}
+ """
+ for exdateProp in tuple(self.properties("EXDATE")):
+ for exdateValue in exdateProp.value():
+ if exdateValue.getValue() == exdate:
+ exdateProp.value().remove(exdateValue)
+ if len(exdateProp.value()) == 0:
+ self.removeProperty(exdateProp)
+
+
def resourceUID(self):
"""
@return: the UID of the subcomponents in this component.
Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/test/test_icalendar.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/test/test_icalendar.py 2014-09-11 21:12:30 UTC (rev 13955)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/twistedcaldav/test/test_icalendar.py 2014-09-11 21:13:49 UTC (rev 13956)
@@ -5575,6 +5575,494 @@
self.fail("Valid calendar should validate")
+ def test_add_exdate(self):
+ data = ((
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+RRULE:FREQ=DAILY
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ (
+ PyCalendarDateTime(2009, 7, 6, 17, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+ PyCalendarDateTime(2009, 7, 6, 10, 0, 0, tzid=PyCalendarTimezone(tzid="US/Pacific")),
+ ),
+
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+EXDATE;TZID=US/Pacific:20090706T100000
+RRULE:FREQ=DAILY
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ ))
+
+ for exdate in data[1]:
+ calendar = Component.fromString(data[0])
+ result = Component.fromString(data[2])
+ calendar.masterComponent().addExdate(exdate)
+ self.assertEqual(normalize_iCalStr(calendar), normalize_iCalStr(result), "Failed exdate add: {}".format(exdate))
+
+
+ def test_remove_exdate(self):
+ data = (
+ (
+ "1.1 Single single-valued exdate",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+RRULE:FREQ=DAILY
+EXDATE;TZID=US/Pacific:20090706T100000
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ (
+ PyCalendarDateTime(2009, 7, 6, 17, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+ PyCalendarDateTime(2009, 7, 6, 10, 0, 0, tzid=PyCalendarTimezone(tzid="US/Pacific")),
+ ),
+
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+RRULE:FREQ=DAILY
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ (
+ "1.2 Single multi-valued exdate",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+RRULE:FREQ=DAILY
+EXDATE;TZID=US/Pacific:20090706T100000,20090707T100000
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ (
+ PyCalendarDateTime(2009, 7, 6, 17, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+ PyCalendarDateTime(2009, 7, 6, 10, 0, 0, tzid=PyCalendarTimezone(tzid="US/Pacific")),
+ ),
+
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+EXDATE;TZID=US/Pacific:20090707T100000
+RRULE:FREQ=DAILY
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ (
+ "1.3 Multiple single-valued exdate",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+RRULE:FREQ=DAILY
+EXDATE;TZID=US/Pacific:20090706T100000
+EXDATE;TZID=US/Pacific:20090707T100000
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ (
+ PyCalendarDateTime(2009, 7, 6, 17, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+ PyCalendarDateTime(2009, 7, 6, 10, 0, 0, tzid=PyCalendarTimezone(tzid="US/Pacific")),
+ ),
+
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+EXDATE;TZID=US/Pacific:20090707T100000
+RRULE:FREQ=DAILY
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ (
+ "1.4 Multiple single- and multi-valued exdate",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+RRULE:FREQ=DAILY
+EXDATE;TZID=US/Pacific:20090706T100000,20090707T100000
+EXDATE;TZID=US/Pacific:20090708T100000
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ (
+ PyCalendarDateTime(2009, 7, 6, 17, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+ PyCalendarDateTime(2009, 7, 6, 10, 0, 0, tzid=PyCalendarTimezone(tzid="US/Pacific")),
+ ),
+
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+EXDATE;TZID=US/Pacific:20090707T100000
+EXDATE;TZID=US/Pacific:20090708T100000
+RRULE:FREQ=DAILY
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ (
+ "1.5 Single single-valued exdate - without match",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+RRULE:FREQ=DAILY
+EXDATE;TZID=US/Pacific:20090707T100000
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ (
+ PyCalendarDateTime(2009, 7, 6, 17, 0, 0, tzid=PyCalendarTimezone(utc=True)),
+ PyCalendarDateTime(2009, 7, 6, 10, 0, 0, tzid=PyCalendarTimezone(tzid="US/Pacific")),
+ ),
+
+ """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:DAYLIGHT
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:FB81D520-ED27-4DBA-8894-45B7612A7621
+DTSTART;TZID=US/Pacific:20090705T100000
+DTEND;TZID=US/Pacific:20090730T103000
+CREATED:20090604T225706Z
+DTSTAMP:20090604T230500Z
+EXDATE;TZID=US/Pacific:20090707T100000
+RRULE:FREQ=DAILY
+SEQUENCE:1
+SUMMARY:TEST
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ )
+
+ for title, calendar, exdates, result in data:
+ for exdate in exdates:
+ cal = Component.fromString(calendar)
+ cal.masterComponent().removeExdate(exdate)
+ self.assertEqual(normalize_iCalStr(cal), normalize_iCalStr(result), "Failed exdate remove: {} {}".format(title, exdate))
+
+
def test_allperuseruids(self):
data = """BEGIN:VCALENDAR
VERSION:2.0
Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/itip.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/itip.py 2014-09-11 21:12:30 UTC (rev 13955)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/itip.py 2014-09-11 21:13:49 UTC (rev 13956)
@@ -206,7 +206,10 @@
component = component.duplicate()
missingDeclined = iTipProcessing.transferItems(calendar, component, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient, remove_matched=True)
if not missingDeclined:
+ # Add the component and make sure to remove any matching EXDATE
calendar.addComponent(component)
+ if current_master is not None:
+ current_master.removeExdate(component.getRecurrenceIDUTC())
if recipient:
iTipProcessing.addTranspForNeedsAction((component,), recipient)
@@ -826,14 +829,32 @@
itip.replaceProperty(Property("PRODID", iCalendarProductID))
itip.addProperty(Property("METHOD", "REQUEST"))
+ return iTipGenerator.generateAttendeeView(itip, attendees, filter_rids)
+
+
+ @staticmethod
+ def generateAttendeeView(calendar, attendees, filter_rids):
+ """
+ Generate an attendee's view of an iCalendar object. The object might be an iTIP
+ message derived from the organizer's event, or it might be a copy of
+ the organizer's event itself. The later is used when "fixing" broken attendee
+ data that needs to be made to look consistent with the organizer's.
+
+ @param calendar: the calendar data to process
+ @type calendar: L{Component}
+ @param attendees: list of attendees to view for
+ @type attendees: L{list}
+ @param filter_rids: list of instances to include, of L{None} for all
+ @type filter_rids: L{list} or L{None}
+ """
# Now filter out components that do not contain every attendee
- itip.attendeesView(attendees, onlyScheduleAgentServer=True)
+ calendar.attendeesView(attendees, onlyScheduleAgentServer=True)
# Now filter out components except the ones specified
- if itip.filterComponents(filter_rids):
+ if calendar.filterComponents(filter_rids):
# Strip out unwanted bits
- iTipGenerator.prepareSchedulingMessage(itip)
- return itip
+ iTipGenerator.prepareSchedulingMessage(calendar)
+ return calendar
else:
return None
Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py 2014-09-11 21:12:30 UTC (rev 13955)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/processing.py 2014-09-11 21:13:49 UTC (rev 13956)
@@ -32,7 +32,8 @@
from twistedcaldav.memcacher import Memcacher
from txdav.caldav.datastore.scheduling.cuaddress import normalizeCUAddr
-from txdav.caldav.datastore.scheduling.itip import iTipProcessing, iTIPRequestStatus
+from txdav.caldav.datastore.scheduling.itip import iTipProcessing, iTIPRequestStatus, \
+ iTipGenerator
from txdav.caldav.datastore.scheduling.utils import getCalendarObjectForRecord
import collections
@@ -1154,7 +1155,8 @@
originator_calendar = (yield calendar_resource.componentForUser(self.originator.principal.uid))
# Get attendee's view of that
- originator_calendar.attendeesView((self.recipient.cuaddr,))
+ originator_calendar = originator_calendar.duplicate()
+ iTipGenerator.generateAttendeeView(originator_calendar, (self.recipient.cuaddr,), None)
# Locate the attendee's copy of the event if it exists.
recipient_resource = (yield getCalendarObjectForRecord(self.txn, self.recipient.principal, self.uid))
Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_itip.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_itip.py 2014-09-11 21:12:30 UTC (rev 13955)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_itip.py 2014-09-11 21:13:49 UTC (rev 13956)
@@ -34,6 +34,297 @@
iCalendar support tests
"""
+ def test_processRequest_overrideOfEXDATE(self):
+ """
+ Test iTIPProcessing.processRequest properly removes an EXDATE when an override is added
+ """
+
+ data = (
+ (
+ "1.1 Single single-value EXDATE",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+RRULE:FREQ=DAILY
+EXDATE:20071115T000000Z
+SUMMARY:Test
+TRANSP:TRANSPARENT
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+SUMMARY:Test1
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+RRULE:FREQ=DAILY
+SUMMARY:Test
+TRANSP:TRANSPARENT
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+SUMMARY:Test1
+TRANSP:TRANSPARENT
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ (
+ "1.2 Single multi-value EXDATE",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+RRULE:FREQ=DAILY
+EXDATE:20071115T000000Z,20071116T000000Z
+SUMMARY:Test
+TRANSP:TRANSPARENT
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+SUMMARY:Test1
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+RRULE:FREQ=DAILY
+EXDATE:20071116T000000Z
+SUMMARY:Test
+TRANSP:TRANSPARENT
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+SUMMARY:Test1
+TRANSP:TRANSPARENT
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ (
+ "1.3 Multiple single-value EXDATEs",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+RRULE:FREQ=DAILY
+EXDATE:20071115T000000Z
+EXDATE:20071116T000000Z
+SUMMARY:Test
+TRANSP:TRANSPARENT
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+SUMMARY:Test1
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+RRULE:FREQ=DAILY
+EXDATE:20071116T000000Z
+SUMMARY:Test
+TRANSP:TRANSPARENT
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+SUMMARY:Test1
+TRANSP:TRANSPARENT
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ (
+ "1.4 Multiple single- and multi-value EXDATEs",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+RRULE:FREQ=DAILY
+EXDATE:20071115T000000Z,20071116T000000Z
+EXDATE:20071117T000000Z
+SUMMARY:Test
+TRANSP:TRANSPARENT
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+SUMMARY:Test1
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+RRULE:FREQ=DAILY
+EXDATE:20071116T000000Z
+EXDATE:20071117T000000Z
+SUMMARY:Test
+TRANSP:TRANSPARENT
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ORGANIZER:mailto:user01 at example.com
+SUMMARY:Test1
+TRANSP:TRANSPARENT
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ )
+
+ for title, calendar_txt, itip_txt, changed_txt in data:
+ calendar = Component.fromString(calendar_txt)
+ itip = Component.fromString(itip_txt)
+ changed = Component.fromString(changed_txt)
+
+ result, _ignore = iTipProcessing.processRequest(itip, calendar, "mailto:user02 at example.com")
+ self.assertEqual(result, changed, msg="Calendar mismatch: %s" % (title,))
+
+
def test_processReply(self):
"""
Test iTIPProcessing.processReply
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140911/beb02804/attachment-0001.html>
More information about the calendarserver-changes
mailing list