<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[14142] CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/14142">14142</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-11-06 19:02:38 -0800 (Thu, 06 Nov 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix for leakage of organizer properties into attendee overrides.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingicaldiffpy">CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/icaldiff.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingitippy">CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/itip.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingtesttest_itippy">CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_itip.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingicaldiffpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/icaldiff.py (14141 => 14142)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/icaldiff.py        2014-11-07 03:01:37 UTC (rev 14141)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/icaldiff.py        2014-11-07 03:02:38 UTC (rev 14142)
</span><span class="lines">@@ -765,9 +765,7 @@
</span><span class="cx"> "EXDATE",
</span><span class="cx"> "STATUS",
</span><span class="cx"> "TRANSP",
</span><del>- "X-APPLE-TRAVEL-START",
</del><span class="cx"> "X-APPLE-TRAVEL-DURATION",
</span><del>- "X-APPLE-TRAVEL-RETURN",
</del><span class="cx"> "X-APPLE-TRAVEL-RETURN-DURATION",
</span><span class="cx"> ))
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingitippy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/itip.py (14141 => 14142)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/itip.py        2014-11-07 03:01:37 UTC (rev 14141)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/itip.py        2014-11-07 03:02:38 UTC (rev 14142)
</span><span class="lines">@@ -67,10 +67,11 @@
</span><span class="cx"> calendar.removeProperty(method)
</span><span class="cx">
</span><span class="cx"> if recipient:
</span><del>- iTipProcessing.addTranspForNeedsAction(calendar.subcomponents(), recipient)
</del><span class="cx">
</span><span class="cx"> # Check for incoming DECLINED
</span><span class="cx"> if creating:
</span><ins>+ iTipProcessing.addTranspForNeedsAction(calendar.subcomponents(), recipient)
+
</ins><span class="cx"> master = calendar.masterComponent()
</span><span class="cx"> for component in tuple(calendar.subcomponents()):
</span><span class="cx"> if component in ignoredComponents or component is master:
</span><span class="lines">@@ -122,10 +123,10 @@
</span><span class="cx"> # overridden components that the organizer added
</span><span class="cx"> current_master = calendar.masterComponent()
</span><span class="cx"> if current_master:
</span><del>- master_valarms = [comp for comp in current_master.subcomponents() if comp.name() == "VALARM"]
- private_comments = current_master.properties("X-CALENDARSERVER-PRIVATE-COMMENT")
- transps = current_master.properties("TRANSP")
- completeds = current_master.properties("COMPLETED")
</del><ins>+ valarms = [comp for comp in current_master.subcomponents() if comp.name() == "VALARM"]
+ private_comments = tuple(current_master.properties("X-CALENDARSERVER-PRIVATE-COMMENT"))
+ transps = tuple(current_master.properties("TRANSP"))
+ completeds = tuple(current_master.properties("COMPLETED"))
</ins><span class="cx"> organizer = current_master.getProperty("ORGANIZER")
</span><span class="cx"> organizer_schedule_status = organizer.parameterValue("SCHEDULE-STATUS", None) if organizer else None
</span><span class="cx"> attendee = current_master.getAttendeeProperty((recipient,))
</span><span class="lines">@@ -133,10 +134,9 @@
</span><span class="cx"> other_props = {}
</span><span class="cx"> for pname in config.Scheduling.CalDAV.PerAttendeeProperties:
</span><span class="cx"> props = tuple(current_master.properties(pname))
</span><del>- if props:
- other_props[pname] = props
</del><ins>+ other_props[pname] = props
</ins><span class="cx"> else:
</span><del>- master_valarms = ()
</del><ins>+ valarms = ()
</ins><span class="cx"> private_comments = ()
</span><span class="cx"> transps = ()
</span><span class="cx"> completeds = ()
</span><span class="lines">@@ -149,31 +149,14 @@
</span><span class="cx"> # Get a new calendar object first
</span><span class="cx"> new_calendar = iTipProcessing.processNewRequest(itip_message, recipient)
</span><span class="cx">
</span><del>- # Copy over master alarms, comments
</del><ins>+ # Copy over master alarms, comments etc
</ins><span class="cx"> master_component = new_calendar.masterComponent()
</span><del>- for alarm in master_valarms:
- master_component.addComponent(alarm)
- for comment in private_comments:
- master_component.addProperty(comment)
- for transp in transps:
- master_component.replaceProperty(transp)
- for completed in completeds:
- master_component.replaceProperty(completed)
- if organizer_schedule_status:
- organizer = master_component.getProperty("ORGANIZER")
- if organizer:
- organizer.setParameter("SCHEDULE-STATUS", organizer_schedule_status)
- if attendee_dtstamp:
- attendee = master_component.getAttendeeProperty((recipient,))
- if attendee:
- attendee.setParameter("X-CALENDARSERVER-DTSTAMP", attendee_dtstamp)
- for props in other_props.values():
- [master_component.replaceProperty(prop) for prop in props]
</del><ins>+ iTipProcessing._transferItems(master_component, valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient)
</ins><span class="cx">
</span><span class="cx"> # Now try to match recurrences in the new calendar
</span><span class="cx"> for component in tuple(new_calendar.subcomponents()):
</span><span class="cx"> if component.name() != "VTIMEZONE" and component.getRecurrenceIDUTC() is not None:
</span><del>- iTipProcessing.transferItems(calendar, component, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient)
</del><ins>+ iTipProcessing.transferItems(calendar, component, valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient)
</ins><span class="cx">
</span><span class="cx"> # Now try to match recurrences from the old calendar
</span><span class="cx"> for component in calendar.subcomponents():
</span><span class="lines">@@ -185,10 +168,12 @@
</span><span class="cx"> new_component = new_calendar.deriveInstance(rid, allowCancelled=allowCancelled and not hidden)
</span><span class="cx"> if new_component is not None:
</span><span class="cx"> new_calendar.addComponent(new_component)
</span><del>- iTipProcessing.transferItems(calendar, new_component, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient)
</del><ins>+ iTipProcessing.transferItems(calendar, new_component, valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient)
</ins><span class="cx"> if hidden:
</span><span class="cx"> new_component.addProperty(Property(Component.HIDDEN_INSTANCE_PROPERTY, "T"))
</span><span class="cx">
</span><ins>+ iTipProcessing.addTranspForNeedsAction(new_calendar.subcomponents(), recipient)
+
</ins><span class="cx"> # Replace the entire object
</span><span class="cx"> return new_calendar, rids
</span><span class="cx">
</span><span class="lines">@@ -204,15 +189,15 @@
</span><span class="cx"> calendar.addComponent(component)
</span><span class="cx"> else:
</span><span class="cx"> component = component.duplicate()
</span><del>- missingDeclined = iTipProcessing.transferItems(calendar, component, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient, remove_matched=True)
</del><ins>+ missingDeclined = iTipProcessing.transferItems(calendar, component, valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient, remove_matched=True)
</ins><span class="cx"> if not missingDeclined:
</span><span class="cx"> # Add the component and make sure to remove any matching EXDATE
</span><span class="cx"> calendar.addComponent(component)
</span><span class="cx"> if current_master is not None:
</span><span class="cx"> current_master.removeExdate(component.getRecurrenceIDUTC())
</span><del>- if recipient:
- iTipProcessing.addTranspForNeedsAction((component,), recipient)
</del><span class="cx">
</span><ins>+ iTipProcessing.addTranspForNeedsAction(calendar.subcomponents(), recipient)
+
</ins><span class="cx"> # Write back the modified object
</span><span class="cx"> return calendar, rids
</span><span class="cx">
</span><span class="lines">@@ -518,7 +503,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @staticmethod
</span><del>- def transferItems(from_calendar, to_component, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient, remove_matched=False):
</del><ins>+ def transferItems(from_calendar, to_component, valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient, remove_matched=False):
</ins><span class="cx"> """
</span><span class="cx"> Transfer properties from a calendar to a component by first trying to match the component in the original calendar and
</span><span class="cx"> use the properties from that, or use the values provided as arguments (which have been derived from the original calendar's
</span><span class="lines">@@ -528,8 +513,8 @@
</span><span class="cx"> @type from_calendar: L{Component}
</span><span class="cx"> @param to_component: the new component to transfer items to
</span><span class="cx"> @type to_component: L{Component}
</span><del>- @param master_valarms: a C{list} of VALARM components from the old master to use
- @type master_valarms: C{list}
</del><ins>+ @param valarms: a C{list} of VALARM components from the old master to use
+ @type valarms: C{list}
</ins><span class="cx"> @param private_comments: a C{list} of private comment properties from the old master to use
</span><span class="cx"> @type private_comments: C{list}
</span><span class="cx"> @param transps: a C{list} of TRANSP properties from the old master to use
</span><span class="lines">@@ -555,67 +540,104 @@
</span><span class="cx"> # Is there a matching component
</span><span class="cx"> matched = from_calendar.overriddenComponent(rid)
</span><span class="cx"> if matched:
</span><del>- # Copy over VALARMs from existing component
- [to_component.addComponent(comp) for comp in matched.subcomponents() if comp.name() == "VALARM"]
- [to_component.addProperty(prop) for prop in matched.properties("X-CALENDARSERVER-ATTENDEE-COMMENT")]
- [to_component.replaceProperty(prop) for prop in matched.properties("TRANSP")]
- [to_component.replaceProperty(prop) for prop in matched.properties("COMPLETED")]
-
</del><ins>+ valarms = [comp for comp in matched.subcomponents() if comp.name() == "VALARM"]
+ private_comments = tuple(matched.properties("X-CALENDARSERVER-PRIVATE-COMMENT"))
+ transps = tuple(matched.properties("TRANSP"))
+ completeds = tuple(matched.properties("COMPLETED"))
</ins><span class="cx"> organizer = matched.getProperty("ORGANIZER")
</span><span class="cx"> organizer_schedule_status = organizer.parameterValue("SCHEDULE-STATUS", None) if organizer else None
</span><del>- if organizer_schedule_status:
- organizer = to_component.getProperty("ORGANIZER")
- if organizer:
- organizer.setParameter("SCHEDULE-STATUS", organizer_schedule_status)
</del><ins>+ attendee = matched.getAttendeeProperty((recipient,))
+ attendee_dtstamp = attendee.parameterValue("X-CALENDARSERVER-DTSTAMP") if attendee else None
+ other_props = {}
+ for pname in config.Scheduling.CalDAV.PerAttendeeProperties:
+ props = tuple(matched.properties(pname))
+ other_props[pname] = props
</ins><span class="cx">
</span><del>- # Remove the old one
- if remove_matched:
- from_calendar.removeComponent(matched)
</del><ins>+ iTipProcessing._transferItems(to_component, valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient)
</ins><span class="cx">
</span><span class="cx"> # Check for incoming DECLINED
</span><del>- attendee = to_component.getAttendeeProperty((recipient,))
- if attendee and attendee.parameterValue("PARTSTAT", "NEEDS-ACTION") == "DECLINED":
</del><ins>+ to_attendee = to_component.getAttendeeProperty((recipient,))
+ if to_attendee and to_attendee.parameterValue("PARTSTAT", "NEEDS-ACTION") == "DECLINED":
</ins><span class="cx"> # If existing item has HIDDEN property copy that over
</span><span class="cx"> if matched.hasProperty(Component.HIDDEN_INSTANCE_PROPERTY):
</span><span class="cx"> to_component.addProperty(Property(Component.HIDDEN_INSTANCE_PROPERTY, "T"))
</span><span class="cx">
</span><del>- if attendee and attendee_dtstamp:
- attendee.setParameter("X-CALENDARSERVER-DTSTAMP", attendee_dtstamp)
</del><ins>+ # Remove the old one
+ if remove_matched:
+ from_calendar.removeComponent(matched)
</ins><span class="cx">
</span><del>- for pname in config.Scheduling.CalDAV.PerAttendeeProperties:
- [to_component.replaceProperty(prop) for prop in matched.properties(pname)]
-
</del><span class="cx"> # Check to see if the new component is cancelled as that could mean we are copying in the wrong attendee state
</span><span class="cx"> if to_component.propertyValue("STATUS") == "CANCELLED":
</span><del>- from_attendee = matched.getAttendeeProperty((recipient,))
- if attendee and from_attendee:
- attendee.setParameter("PARTSTAT", from_attendee.parameterValue("PARTSTAT", "NEEDS-ACTION"))
</del><ins>+ if attendee and to_attendee:
+ to_attendee.setParameter("PARTSTAT", attendee.parameterValue("PARTSTAT", "NEEDS-ACTION"))
</ins><span class="cx">
</span><span class="cx"> else:
</span><ins>+ iTipProcessing._transferItems(to_component, valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient)
+
</ins><span class="cx"> # Check for incoming DECLINED
</span><span class="cx"> attendee = to_component.getAttendeeProperty((recipient,))
</span><span class="cx"> if attendee and attendee.parameterValue("PARTSTAT", "NEEDS-ACTION") == "DECLINED":
</span><span class="cx"> return True
</span><span class="cx">
</span><del>- # It is a new override - copy any valarms on the existing master component
- # into the new one.
- [to_component.addComponent(alarm) for alarm in master_valarms]
- [to_component.addProperty(comment) for comment in private_comments]
- [to_component.replaceProperty(transp) for transp in transps]
- [to_component.replaceProperty(completed) for completed in completeds]
</del><ins>+ return False
</ins><span class="cx">
</span><del>- if organizer_schedule_status:
- organizer = to_component.getProperty("ORGANIZER")
- if organizer:
- organizer.setParameter("SCHEDULE-STATUS", organizer_schedule_status)
- if attendee_dtstamp:
- attendee = to_component.getAttendeeProperty((recipient,))
- if attendee:
- attendee.setParameter("X-CALENDARSERVER-DTSTAMP", attendee_dtstamp)
</del><span class="cx">
</span><del>- for props in other_props.values():
- [to_component.replaceProperty(prop) for prop in props]
</del><ins>+ @staticmethod
+ def _transferItems(to_component, valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, recipient):
+ """
+ Transfer properties the key per-attendee properties from one component to another. Note that the key properties are pulled out into separate items, because they
+ may have been derived from the master.
</ins><span class="cx">
</span><ins>+ @param to_component: the new component to transfer items to
+ @type to_component: L{Component}
+ @param valarms: a C{list} of VALARM components from the old master to use
+ @type valarms: C{list}
+ @param private_comments: a C{list} of private comment properties from the old master to use
+ @type private_comments: C{list}
+ @param transps: a C{list} of TRANSP properties from the old master to use
+ @type transps: C{list}
+ @param completeds: a C{list} of COMPLETED properties from the old master to use
+ @type completeds: C{list}
+ @param organizer_schedule_status: a the SCHEDULE-STATUS value for the organizer from the old master to use
+ @type organizer_schedule_status: C{str}
+ @param attendee_dtstamp: an the ATTENDEE DTSTAMP parameter value from the old master to use
+ @type attendee_dtstamp: C{str}
+ @param other_props: other properties from the old master to use
+ @type other_props: C{list}
+ @param recipient: the calendar user address of the attendee whose data is being processed
+ @type recipient: C{str}
+
+ @return: C{True} if an EXDATE match occurred requiring the incoming component to be removed.
+ """
+
+ # It is a new override - copy any valarms on the existing master component
+ # into the new one. But first remove any of the stuff we want to copy from
+ # the component being copied to.
+ to_component.removeAlarms()
+ to_component.removeProperty("X-CALENDARSERVER-PRIVATE-COMMENT")
+ to_component.removeProperty("TRANSP")
+ to_component.removeProperty("COMPLETED")
+ for propname in other_props.keys():
+ to_component.removeProperty(propname)
+
+ [to_component.addComponent(alarm) for alarm in valarms]
+ [to_component.addProperty(comment) for comment in private_comments]
+ [to_component.replaceProperty(transp) for transp in transps]
+ [to_component.replaceProperty(completed) for completed in completeds]
+ for props in other_props.values():
+ [to_component.replaceProperty(prop) for prop in props]
+
+ if organizer_schedule_status:
+ organizer = to_component.getProperty("ORGANIZER")
+ if organizer:
+ organizer.setParameter("SCHEDULE-STATUS", organizer_schedule_status)
+
+ # ATTENDEE property merge
+ attendee = to_component.getAttendeeProperty((recipient,))
+
+ if attendee_dtstamp and attendee:
+ attendee.setParameter("X-CALENDARSERVER-DTSTAMP", attendee_dtstamp)
+
</ins><span class="cx"> return False
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer53devtxdavcaldavdatastoreschedulingtesttest_itippy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_itip.py (14141 => 14142)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_itip.py        2014-11-07 03:01:37 UTC (rev 14141)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/txdav/caldav/datastore/scheduling/test/test_itip.py        2014-11-07 03:02:38 UTC (rev 14142)
</span><span class="lines">@@ -597,6 +597,582 @@
</span><span class="cx"> self.assertEqual(result, changed, msg="Calendar mismatch: %s" % (title,))
</span><span class="cx">
</span><span class="cx">
</span><ins>+ 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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+ORGANIZER:mailto:user01@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@example.com")
+ self.assertEqual(result, changed, msg="Calendar mismatch: %s" % (title,))
+
+
+ def test_processRequest_propertyLeakage(self):
+ """
+ Test iTIPProcessing.processRequest properly ignores properties from organizer that need to be overridden by
+ the attendee
+ """
+
+ data = (
+ (
+ "1.1 All ACCEPTED, no alarm",
+ """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@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+RRULE:FREQ=DAILY
+SUMMARY:Test
+TRANSP:TRANSPARENT
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT30M
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+RRULE:FREQ=DAILY
+SUMMARY:Test
+TRANSP:OPAQUE
+X-CALENDARSERVER-PRIVATE-COMMENT:foobar1
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT1H
+X-APPLE-TRAVEL-RETURN-DURATION;VALUE=DURATION:PT1H
+BEGIN:VALARM
+DESCRIPTION:Event reminder
+TRIGGER:-PT1M
+ACTION:DISPLAY
+END:VALARM
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+SUMMARY:Test1
+TRANSP:OPAQUE
+X-CALENDARSERVER-PRIVATE-COMMENT:foobar2
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT2H
+X-APPLE-TRAVEL-RETURN-DURATION;VALUE=DURATION:PT2H
+BEGIN:VALARM
+DESCRIPTION:Event reminder
+TRIGGER:-PT2M
+ACTION:DISPLAY
+END:VALARM
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071116T000000Z
+DTSTART:20071116T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+SUMMARY:Test1
+TRANSP:OPAQUE
+X-CALENDARSERVER-PRIVATE-COMMENT:foobar3
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT3H
+X-APPLE-TRAVEL-RETURN-DURATION;VALUE=DURATION:PT3H
+BEGIN:VALARM
+DESCRIPTION:Event reminder
+TRIGGER:-PT3M
+ACTION:DISPLAY
+END:VALARM
+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@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+RRULE:FREQ=DAILY
+SUMMARY:Test
+TRANSP:TRANSPARENT
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT30M
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+SUMMARY:Test1
+TRANSP:TRANSPARENT
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT30M
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071116T000000Z
+DTSTART:20071116T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+SUMMARY:Test1
+TRANSP:TRANSPARENT
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT30M
+END:VEVENT
+END:VCALENDAR
+""",
+ ),
+ (
+ "1.2 All DECLINED, with alarm",
+ """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@example.com
+ATTENDEE;PARTSTAT=DECLINED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+RRULE:FREQ=DAILY
+SUMMARY:Test
+TRANSP:TRANSPARENT
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT30M
+BEGIN:VALARM
+DESCRIPTION:Attendee reminder
+TRIGGER:-PT1M
+ACTION:DISPLAY
+END:VALARM
+END:VEVENT
+END:VCALENDAR
+""",
+ """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=DECLINED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+RRULE:FREQ=DAILY
+SUMMARY:Test
+TRANSP:OPAQUE
+X-CALENDARSERVER-PRIVATE-COMMENT:foobar1
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT1H
+X-APPLE-TRAVEL-RETURN-DURATION;VALUE=DURATION:PT1H
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=DECLINED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+SUMMARY:Test1
+TRANSP:OPAQUE
+X-CALENDARSERVER-PRIVATE-COMMENT:foobar2
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT2H
+X-APPLE-TRAVEL-RETURN-DURATION;VALUE=DURATION:PT2H
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071116T000000Z
+DTSTART:20071116T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=DECLINED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+SUMMARY:Test1
+TRANSP:OPAQUE
+X-CALENDARSERVER-PRIVATE-COMMENT:foobar3
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT3H
+X-APPLE-TRAVEL-RETURN-DURATION;VALUE=DURATION:PT3H
+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@example.com
+ATTENDEE;PARTSTAT=DECLINED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+RRULE:FREQ=DAILY
+SUMMARY:Test
+TRANSP:TRANSPARENT
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT30M
+BEGIN:VALARM
+DESCRIPTION:Attendee reminder
+TRIGGER:-PT1M
+ACTION:DISPLAY
+END:VALARM
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=DECLINED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+SUMMARY:Test1
+TRANSP:TRANSPARENT
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT30M
+BEGIN:VALARM
+DESCRIPTION:Attendee reminder
+TRIGGER:-PT1M
+ACTION:DISPLAY
+END:VALARM
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071116T000000Z
+DTSTART:20071116T000000Z
+DURATION:PT1H
+DTSTAMP:20071114T000000Z
+ATTENDEE:mailto:user01@example.com
+ATTENDEE;PARTSTAT=DECLINED:mailto:user02@example.com
+ORGANIZER:mailto:user01@example.com
+SUMMARY:Test1
+TRANSP:TRANSPARENT
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT30M
+BEGIN:VALARM
+DESCRIPTION:Attendee reminder
+TRIGGER:-PT1M
+ACTION:DISPLAY
+END:VALARM
+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@example.com")
+ self.assertEqual(result, changed, msg="Calendar mismatch: %s" % (title,))
+
+
</ins><span class="cx"> def test_update_attendee_partstat(self):
</span><span class="cx">
</span><span class="cx"> data = (
</span></span></pre>
</div>
</div>
</body>
</html>