<!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>[15067] CalendarServer/trunk</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/15067">15067</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2015-08-21 12:47:02 -0700 (Fri, 21 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix schedule-changes for overridden instance add/remove.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkrequirementsdevtxt">CalendarServer/trunk/requirements-dev.txt</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingicaldiffpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingimplicitpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingprocessingpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingtesttest_icaldiffpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icaldiff.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingtesttest_itippy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_itip.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkrequirementsdevtxt"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/requirements-dev.txt (15066 => 15067)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/requirements-dev.txt        2015-08-21 19:43:49 UTC (rev 15066)
+++ CalendarServer/trunk/requirements-dev.txt        2015-08-21 19:47:02 UTC (rev 15067)
</span><span class="lines">@@ -8,4 +8,4 @@
</span><span class="cx"> q
</span><span class="cx"> tl.eggdeps
</span><span class="cx"> --editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk@14856#egg=CalDAVClientLibrary
</span><del>---editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@15029#egg=CalDAVTester
</del><ins>+--editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@15066#egg=CalDAVTester
</ins></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingicaldiffpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py (15066 => 15067)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py        2015-08-21 19:43:49 UTC (rev 15066)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py        2015-08-21 19:47:02 UTC (rev 15067)
</span><span class="lines">@@ -756,7 +756,7 @@
</span><span class="cx"> return partstatChanged
</span><span class="cx">
</span><span class="cx">
</span><del>- def whatIsDifferent(self, isiTip=True):
</del><ins>+ def whatIsDifferent(self, timeRangeCheck=False):
</ins><span class="cx"> """
</span><span class="cx"> Compare the two calendar objects in their entirety and return a list of properties
</span><span class="cx"> and PARTSTAT parameters that are different.
</span><span class="lines">@@ -786,7 +786,7 @@
</span><span class="cx"> for key in (oldset & newset):
</span><span class="cx"> component1 = oldmap[key]
</span><span class="cx"> component2 = newmap[key]
</span><del>- self._diffComponents(component1, component2, rids, needs_action_changes, isiTip)
</del><ins>+ self._diffComponents(component1, component2, rids, needs_action_changes, timeRangeCheck)
</ins><span class="cx">
</span><span class="cx"> # Now verify that each additional component in oldset matches a derived component in newset
</span><span class="cx"> for key in oldset - newset:
</span><span class="lines">@@ -794,27 +794,21 @@
</span><span class="cx"> oldcomponent = oldmap[key]
</span><span class="cx"> newcomponent = self.newcalendar.deriveInstance(rid)
</span><span class="cx"> if newcomponent is None:
</span><del>- # For the non iTIP case we must report missing components on either side. Marking
- # the DTSTART as changed is enough to trigger logic in the caller to treat this
- # as a significant change.
- if not isiTip:
- rids[rid.getText() if rid is not None else ""] = {"DTSTART": set()}
</del><ins>+ # Set the entry to None to indicate removal
+ rids[rid] = None
</ins><span class="cx"> continue
</span><del>- self._diffComponents(oldcomponent, newcomponent, rids, needs_action_changes, isiTip)
</del><ins>+ self._diffComponents(oldcomponent, newcomponent, rids, needs_action_changes, timeRangeCheck)
</ins><span class="cx">
</span><span class="cx"> # Now verify that each additional component in oldset matches a derived component in newset
</span><span class="cx"> for key in newset - oldset:
</span><span class="cx"> rid = key[2]
</span><span class="cx"> oldcomponent = self.oldcalendar.deriveInstance(rid)
</span><span class="cx"> if oldcomponent is None:
</span><del>- # For the non iTIP case we must report missing components on either side. Marking
- # the DTSTART as changed is enough to trigger logic in the caller to treat this
- # as a significant change.
- if not isiTip:
- rids[rid.getText() if rid is not None else ""] = {"DTSTART": set()}
</del><ins>+ # Set the entry to an empty dict to indicate addition
+ rids[rid] = {}
</ins><span class="cx"> continue
</span><span class="cx"> newcomponent = newmap[key]
</span><del>- self._diffComponents(oldcomponent, newcomponent, rids, needs_action_changes, isiTip)
</del><ins>+ self._diffComponents(oldcomponent, newcomponent, rids, needs_action_changes, timeRangeCheck)
</ins><span class="cx">
</span><span class="cx"> return (rids, needs_action_changes,)
</span><span class="cx">
</span><span class="lines">@@ -843,8 +837,11 @@
</span><span class="cx"> @rtype: L{bool}
</span><span class="cx"> """
</span><span class="cx">
</span><del>- rids, _ignore_changes = self.whatIsDifferent(isiTip=False)
</del><ins>+ rids, _ignore_changes = self.whatIsDifferent(timeRangeCheck=True)
</ins><span class="cx"> for props in rids.values():
</span><ins>+ if not props:
+ # Component was added (props == {}) or removed (props is None)
+ return True
</ins><span class="cx"> props = frozenset(props.keys())
</span><span class="cx"> if props & self.TRPROPS:
</span><span class="cx"> return True
</span><span class="lines">@@ -868,6 +865,8 @@
</span><span class="cx"> recurrence_reschedule = False
</span><span class="cx">
</span><span class="cx"> for rid, props in diffs.iteritems():
</span><ins>+ if props is None:
+ continue
</ins><span class="cx"> if any([testprop in props for testprop in (
</span><span class="cx"> "DTSTART",
</span><span class="cx"> "DTEND",
</span><span class="lines">@@ -921,13 +920,13 @@
</span><span class="cx"> return (date_changed_rids, recurrence_reschedule,)
</span><span class="cx">
</span><span class="cx">
</span><del>- def _componentDuplicateAndNormalize(self, comp, isiTip=True):
</del><ins>+ def _componentDuplicateAndNormalize(self, comp, timeRangeCheck=False):
</ins><span class="cx"> comp = comp.duplicate()
</span><span class="cx"> comp.normalizePropertyValueLists("EXDATE")
</span><span class="cx"> comp.removeAlarms()
</span><span class="cx"> comp.normalizeAll()
</span><span class="cx"> comp.normalizeAttachments()
</span><del>- if isiTip:
</del><ins>+ if not timeRangeCheck:
</ins><span class="cx"> comp.removePropertyParameters("ORGANIZER", ("SCHEDULE-STATUS",))
</span><span class="cx"> comp.removePropertyParameters("ATTENDEE", ("SCHEDULE-STATUS", "SCHEDULE-FORCE-SEND",))
</span><span class="cx"> comp.removePropertyParameters("VOTER", ("SCHEDULE-STATUS", "SCHEDULE-FORCE-SEND",))
</span><span class="lines">@@ -935,7 +934,7 @@
</span><span class="cx"> return comp
</span><span class="cx">
</span><span class="cx">
</span><del>- def _diffComponents(self, comp1, comp2, rids, needs_action_rids, isiTip=True):
</del><ins>+ def _diffComponents(self, comp1, comp2, rids, needs_action_rids, timeRangeCheck=False):
</ins><span class="cx">
</span><span class="cx"> assert isinstance(comp1, Component) and isinstance(comp2, Component)
</span><span class="cx">
</span><span class="lines">@@ -944,8 +943,8 @@
</span><span class="cx"> return
</span><span class="cx">
</span><span class="cx"> # Duplicate then normalize for comparison
</span><del>- comp1 = self._componentDuplicateAndNormalize(comp1, isiTip)
- comp2 = self._componentDuplicateAndNormalize(comp2, isiTip)
</del><ins>+ comp1 = self._componentDuplicateAndNormalize(comp1, timeRangeCheck)
+ comp2 = self._componentDuplicateAndNormalize(comp2, timeRangeCheck)
</ins><span class="cx">
</span><span class="cx"> # Diff all the properties
</span><span class="cx"> propdiff = set(comp1.properties()) ^ set(comp2.properties())
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingimplicitpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py (15066 => 15067)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py        2015-08-21 19:43:49 UTC (rev 15066)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py        2015-08-21 19:47:02 UTC (rev 15067)
</span><span class="lines">@@ -858,6 +858,10 @@
</span><span class="cx"> checkOrganizerValue = False
</span><span class="cx"> for rid, props in diffs.iteritems():
</span><span class="cx">
</span><ins>+ # Ignore this case - it should only happen when there is no master component
+ if not props:
+ continue
+
</ins><span class="cx"> # Ignore sequence only changes
</span><span class="cx"> if "SEQUENCE" in props and len(props) == 1:
</span><span class="cx"> continue
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingprocessingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py (15066 => 15067)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py        2015-08-21 19:43:49 UTC (rev 15066)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py        2015-08-21 19:47:02 UTC (rev 15067)
</span><span class="lines">@@ -572,6 +572,11 @@
</span><span class="cx"> # Build the schedule-changes XML element
</span><span class="cx"> update_details = []
</span><span class="cx"> for rid, props_changed in sorted(rids.iteritems(), key=lambda x: x[0]):
</span><ins>+
+ # We do not report removals as those will already have been processed via a CANCEL
+ if props_changed is None:
+ continue
+
</ins><span class="cx"> recurrence = []
</span><span class="cx"> if rid is None:
</span><span class="cx"> recurrence.append(customxml.Master())
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingtesttest_icaldiffpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icaldiff.py (15066 => 15067)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icaldiff.py        2015-08-21 19:43:49 UTC (rev 15066)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_icaldiff.py        2015-08-21 19:47:02 UTC (rev 15067)
</span><span class="lines">@@ -4719,8 +4719,8 @@
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><span class="cx"> """,
</span><ins>+ {"20080602T120000Z": None},
</ins><span class="cx"> {},
</span><del>- {},
</del><span class="cx"> ),
</span><span class="cx"> (
</span><span class="cx"> "#4.2 Override component added",
</span><span class="lines">@@ -4794,7 +4794,7 @@
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><span class="cx"> """,
</span><del>- {"20080602T120000Z": {"DTSTART": set()}},
</del><ins>+ {"20080602T120000Z": None},
</ins><span class="cx"> {},
</span><span class="cx"> ),
</span><span class="cx"> (
</span><span class="lines">@@ -4830,7 +4830,7 @@
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><span class="cx"> """,
</span><del>- {"20080602T120000Z": {"DTSTART": set()}},
</del><ins>+ {"20080602T120000Z": {}},
</ins><span class="cx"> {},
</span><span class="cx"> ),
</span><span class="cx"> )
</span><span class="lines">@@ -4845,7 +4845,8 @@
</span><span class="cx">
</span><span class="cx"> for description, calendar1, calendar2, rids, changes in itertools.chain(data5,):
</span><span class="cx"> differ = iCalDiff(Component.fromString(calendar1), Component.fromString(calendar2), False)
</span><del>- got_rids, got_changes = differ.whatIsDifferent(isiTip=False)
</del><ins>+ got_rids, got_changes = differ.whatIsDifferent()
+ rids = dict([(DateTime.parseText(k) if k else None, v) for k, v in rids.items()])
</ins><span class="cx"> self.assertEqual(got_rids, rids, msg="%s expected R-IDs: '%s', got: '%s'" % (description, rids, got_rids,))
</span><span class="cx"> self.assertEqual(got_changes, changes, msg="%s expected changes R-IDs: '%s', got: '%s'" % (description, changes, got_changes,))
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingtesttest_itippy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_itip.py (15066 => 15067)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_itip.py        2015-08-21 19:43:49 UTC (rev 15066)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_itip.py        2015-08-21 19:47:02 UTC (rev 15067)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><span class="cx"> """,
</span><del>- 0,
</del><ins>+ 1,
</ins><span class="cx"> ),
</span><span class="cx"> (
</span><span class="cx"> "2.1 partstat change pinned to sequence - changed",
</span></span></pre>
</div>
</div>
</body>
</html>