<!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>[13786] 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/13786">13786</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-07-24 08:56:17 -0700 (Thu, 24 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Don't update the TIME_RANGE table when there are no changes to it.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktwistedcaldavstdconfigpy">CalendarServer/trunk/twistedcaldav/stdconfig.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingicaldiffpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingprocessingpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoresqlpy">CalendarServer/trunk/txdav/caldav/datastore/sql.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoretesttest_sqlpy">CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktwistedcaldavstdconfigpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py (13785 => 13786)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/stdconfig.py        2014-07-24 15:55:09 UTC (rev 13785)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py        2014-07-24 15:56:17 UTC (rev 13786)
</span><span class="lines">@@ -265,59 +265,59 @@
</span><span class="cx"> #
</span><span class="cx"> "BindAddresses": [], # List of IP addresses to bind to [empty = all]
</span><span class="cx"> "BindHTTPPorts": [], # List of port numbers to bind to for HTTP
</span><del>- # [empty = same as "Port"]
</del><ins>+ # [empty = same as "Port"]
</ins><span class="cx"> "BindSSLPorts": [], # List of port numbers to bind to for SSL
</span><del>- # [empty = same as "SSLPort"]
</del><ins>+ # [empty = same as "SSLPort"]
</ins><span class="cx"> "InheritFDs": [], # File descriptors to inherit for HTTP requests
</span><del>- # (empty = don't inherit)
</del><ins>+ # (empty = don't inherit)
</ins><span class="cx"> "InheritSSLFDs": [], # File descriptors to inherit for HTTPS requests
</span><del>- # (empty = don't inherit)
</del><ins>+ # (empty = don't inherit)
</ins><span class="cx"> "MetaFD": 0, # Inherited file descriptor to call recvmsg() on to
</span><del>- # receive sockets (none = don't inherit)
</del><ins>+ # receive sockets (none = don't inherit)
</ins><span class="cx">
</span><span class="cx"> "UseMetaFD": True, # Use a 'meta' FD, i.e. an FD to transmit other FDs
</span><del>- # to slave processes.
</del><ins>+ # to slave processes.
</ins><span class="cx">
</span><span class="cx"> "UseDatabase": True, # True: database; False: files
</span><span class="cx">
</span><span class="cx"> "TransactionTimeoutSeconds": 300, # Timeout transactions that take longer than
</span><del>- # the specified number of seconds. Zero means
- # no timeouts. 5 minute default.
</del><ins>+ # the specified number of seconds. Zero means
+ # no timeouts. 5 minute default.
</ins><span class="cx">
</span><span class="cx"> "DBType": "", # 2 possible values: empty, meaning 'spawn postgres
</span><del>- # yourself', or 'postgres', meaning 'connect to a
- # postgres database as specified by the 'DSN'
- # configuration key. Will support more values in
- # the future.
</del><ins>+ # yourself', or 'postgres', meaning 'connect to a
+ # postgres database as specified by the 'DSN'
+ # configuration key. Will support more values in
+ # the future.
</ins><span class="cx">
</span><span class="cx"> "SpawnedDBUser": "caldav", # The username to use when DBType is empty
</span><span class="cx">
</span><span class="cx"> "DBImportFile": "", # File path to SQL file to import at startup (includes schema)
</span><span class="cx">
</span><span class="cx"> "DSN": "", # Data Source Name. Used to connect to an external
</span><del>- # database if DBType is non-empty. Format varies
- # depending on database type.
</del><ins>+ # database if DBType is non-empty. Format varies
+ # depending on database type.
</ins><span class="cx">
</span><span class="cx"> "DBAMPFD": 0, # Internally used by database to tell slave
</span><del>- # processes to inherit a file descriptor and use it
- # as an AMP connection over a UNIX socket; see
- # twext.enterprise.adbapi2.ConnectionPoolConnection
</del><ins>+ # processes to inherit a file descriptor and use it
+ # as an AMP connection over a UNIX socket; see
+ # twext.enterprise.adbapi2.ConnectionPoolConnection
</ins><span class="cx">
</span><span class="cx"> "SharedConnectionPool": False, # Use a shared database connection pool in
</span><del>- # the master process, rather than having
- # each client make its connections directly.
</del><ins>+ # the master process, rather than having
+ # each client make its connections directly.
</ins><span class="cx">
</span><span class="cx"> "FailIfUpgradeNeeded": True, # Set to True to prevent the server or utility
</span><span class="cx"> # tools from running if the database needs a schema
</span><span class="cx"> # upgrade.
</span><span class="cx"> "StopAfterUpgradeTriggerFile": "stop_after_upgrade", # if this file exists in ConfigRoot, stop
</span><del>- # the service after finishing upgrade phase
</del><ins>+ # the service after finishing upgrade phase
</ins><span class="cx">
</span><span class="cx"> "UpgradeHomePrefix": "", # When upgrading, only upgrade homes where the owner UID starts with
</span><del>- # with the specified prefix. The upgrade will only be partial and only
- # apply to upgrade pieces that affect entire homes. The upgrade will
- # need to be run again without this prefix set to complete the overall
- # upgrade.
</del><ins>+ # with the specified prefix. The upgrade will only be partial and only
+ # apply to upgrade pieces that affect entire homes. The upgrade will
+ # need to be run again without this prefix set to complete the overall
+ # upgrade.
</ins><span class="cx">
</span><span class="cx"> #
</span><span class="cx"> # Work queue configuration information
</span><span class="lines">@@ -652,21 +652,21 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> "RestrictCalendarsToOneComponentType" : True, # Only allow calendars to be created with a single component type
</span><del>- # If this is on, it will also trigger an upgrade behavior that will
- # split existing calendars into multiples based on component type.
- # If on, it will also cause new accounts to provision with separate
- # calendars for events and tasks.
</del><ins>+ # If this is on, it will also trigger an upgrade behavior that will
+ # split existing calendars into multiples based on component type.
+ # If on, it will also cause new accounts to provision with separate
+ # calendars for events and tasks.
</ins><span class="cx">
</span><span class="cx"> "SupportedComponents" : [ # Set of supported iCalendar components
</span><span class="cx"> "VEVENT",
</span><span class="cx"> "VTODO",
</span><del>- #"VPOLL",
</del><ins>+ # "VPOLL",
</ins><span class="cx"> ],
</span><span class="cx">
</span><span class="cx"> "ParallelUpgrades" : False, # Perform upgrades - currently only the
</span><del>- # database -> filesystem migration - but in
- # the future, hopefully all relevant
- # upgrades - in parallel in subprocesses.
</del><ins>+ # database -> filesystem migration - but in
+ # the future, hopefully all relevant
+ # upgrades - in parallel in subprocesses.
</ins><span class="cx">
</span><span class="cx"> "MergeUpgrades": False, # During the upgrade phase of startup, rather than
</span><span class="cx"> # skipping homes found both on the filesystem and in
</span><span class="lines">@@ -820,13 +820,13 @@
</span><span class="cx"> "Always" : False, # Override augments setting and always auto-schedule
</span><span class="cx"> "AllowUsers" : False, # Allow auto-schedule for users
</span><span class="cx"> "DefaultMode" : "automatic", # Default mode for auto-schedule processing, one of:
</span><del>- # "none" - no auto-scheduling
- # "accept-always" - always accept, ignore busy time
- # "decline-always" - always decline, ignore free time
- # "accept-if-free" - accept if free, do nothing if busy
- # "decline-if-busy" - decline if busy, do nothing if free
- # "automatic" - accept if free, decline if busy
- "FutureFreeBusyDays" : 3 * 365, # How far into the future to check for booking conflicts
</del><ins>+ # "none" - no auto-scheduling
+ # "accept-always" - always accept, ignore busy time
+ # "decline-always" - always decline, ignore free time
+ # "accept-if-free" - accept if free, do nothing if busy
+ # "decline-if-busy" - decline if busy, do nothing if free
+ # "automatic" - accept if free, decline if busy
+ "FutureFreeBusyDays" : 3 * 365, # How far into the future to check for booking conflicts
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> "WorkQueues" : {
</span><span class="lines">@@ -1008,29 +1008,29 @@
</span><span class="cx"> "Port": 11311,
</span><span class="cx"> "HandleCacheTypes": [
</span><span class="cx"> "Default",
</span><del>-# "OpenDirectoryBacker",
-# "ImplicitUIDLock",
-# "RefreshUIDLock",
-# "DIGESTCREDENTIALS",
-# "resourceInfoDB",
-# "pubsubnodes",
-# "FBCache",
-# "ScheduleAddressMapper",
-# "SQL.props",
-# "SQL.calhome",
-# "SQL.adbkhome",
</del><ins>+ # "OpenDirectoryBacker",
+ # "ImplicitUIDLock",
+ # "RefreshUIDLock",
+ # "DIGESTCREDENTIALS",
+ # "resourceInfoDB",
+ # "pubsubnodes",
+ # "FBCache",
+ # "ScheduleAddressMapper",
+ # "SQL.props",
+ # "SQL.calhome",
+ # "SQL.adbkhome",
</ins><span class="cx"> ]
</span><span class="cx"> },
</span><del>-# "Shared": {
-# "ClientEnabled": True,
-# "ServerEnabled": True,
-# "BindAddress": "127.0.0.1",
-# "Port": 11211,
-# "HandleCacheTypes": [
-# "ProxyDB",
-# "PrincipalToken",
-# ]
-# },
</del><ins>+ # "Shared": {
+ # "ClientEnabled": True,
+ # "ServerEnabled": True,
+ # "BindAddress": "127.0.0.1",
+ # "Port": 11211,
+ # "HandleCacheTypes": [
+ # "ProxyDB",
+ # "PrincipalToken",
+ # ]
+ # },
</ins><span class="cx"> },
</span><span class="cx"> "memcached": "memcached", # Find in PATH
</span><span class="cx"> "MaxMemory": 0, # Megabytes
</span><span class="lines">@@ -1110,6 +1110,7 @@
</span><span class="cx"> "FreeBusyIndexExpandAheadDays": 365,
</span><span class="cx"> "FreeBusyIndexExpandMaxDays": 5 * 365,
</span><span class="cx"> "FreeBusyIndexDelayedExpand": True,
</span><ins>+ "FreeBusyIndexSmartUpdate": True,
</ins><span class="cx">
</span><span class="cx"> # The RootResource uses a twext property store. Specify the class here
</span><span class="cx"> "RootResourcePropStoreClass": "txweb2.dav.xattrprops.xattrPropertyStore",
</span><span class="lines">@@ -1304,7 +1305,7 @@
</span><span class="cx"> # non-default values later.) -glyph
</span><span class="cx"> if previousAbsoluteName in configDict and (
</span><span class="cx"> configDict[previousAbsoluteName] == inDict[lastPath]
</span><del>- ):
</del><ins>+ ):
</ins><span class="cx"> userSpecifiedPath = configDict[previousRelativeName]
</span><span class="cx"> else:
</span><span class="cx"> userSpecifiedPath = inDict[lastPath]
</span><span class="lines">@@ -1359,12 +1360,16 @@
</span><span class="cx"> maxConnections += configDict.MaxDBConnectionsPerPool
</span><span class="cx"> else:
</span><span class="cx"> # Otherwise the master *and* each worker process will be connecting
</span><del>- maxConnections += ((configDict.MultiProcess.ProcessCount + 1) *
- configDict.MaxDBConnectionsPerPool)
</del><ins>+ maxConnections += (
+ (configDict.MultiProcess.ProcessCount + 1) *
+ configDict.MaxDBConnectionsPerPool
+ )
</ins><span class="cx">
</span><span class="cx"> configDict.Postgres.MaxConnections = maxConnections
</span><del>- configDict.Postgres.SharedBuffers = int(configDict.Postgres.MaxConnections *
- configDict.Postgres.BuffersToConnectionsRatio)
</del><ins>+ configDict.Postgres.SharedBuffers = int(
+ configDict.Postgres.MaxConnections *
+ configDict.Postgres.BuffersToConnectionsRatio
+ )
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1622,8 +1627,7 @@
</span><span class="cx"> topic = getAPNTopicFromCertificate(certPath)
</span><span class="cx"> service[protocol]["Topic"] = topic
</span><span class="cx"> else:
</span><del>- log.error("APNS certificate not found: %s" %
- (certPath,))
</del><ins>+ log.error("APNS certificate not found: %s" % (certPath,))
</ins><span class="cx"> else:
</span><span class="cx"> log.error("APNS certificate path not specified")
</span><span class="cx">
</span><span class="lines">@@ -1688,8 +1692,7 @@
</span><span class="cx"> pass
</span><span class="cx"> except KeychainPasswordNotFound:
</span><span class="cx"> # The password doesn't exist in the keychain.
</span><del>- log.info("iMIP %s password not found in keychain" %
- (direction,))
</del><ins>+ log.info("iMIP %s password not found in keychain" % (direction,))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1755,7 +1758,7 @@
</span><span class="cx"> _preUpdateDirectoryService,
</span><span class="cx"> _preUpdateResourceService,
</span><span class="cx"> _preUpdateDirectoryAddressBookBackingDirectoryService,
</span><del>- )
</del><ins>+)
</ins><span class="cx"> POST_UPDATE_HOOKS = (
</span><span class="cx"> _updateMultiProcess,
</span><span class="cx"> _updateDataStore,
</span><span class="lines">@@ -1773,7 +1776,7 @@
</span><span class="cx"> _updateSharing,
</span><span class="cx"> # _updateServers,
</span><span class="cx"> _updateCompliance,
</span><del>- )
</del><ins>+)
</ins><span class="cx">
</span><span class="cx"> def _cleanup(configDict, defaultDict):
</span><span class="cx"> cleanDict = copy.deepcopy(configDict)
</span><span class="lines">@@ -1803,7 +1806,7 @@
</span><span class="cx"> del cleanDict[oldKey]
</span><span class="cx">
</span><span class="cx"> renamedOptions = {
</span><del>-# "BindAddress": "BindAddresses",
</del><ins>+ # "BindAddress": "BindAddresses",
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for key in configDict:
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingicaldiffpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py (13785 => 13786)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py        2014-07-24 15:55:09 UTC (rev 13785)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py        2014-07-24 15:56:17 UTC (rev 13786)
</span><span class="lines">@@ -346,7 +346,7 @@
</span><span class="cx">
</span><span class="cx"> # If smart_merge is happening, then derive an instance in the new data as the change in the old
</span><span class="cx"> # data is valid and likely due to some other attendee changing their status.
</span><del>- if self.smart_merge:
</del><ins>+ if self.smart_merge:
</ins><span class="cx"> newOverride = self.newcalendar.deriveInstance(rid, allowCancelled=True)
</span><span class="cx"> if newOverride is None:
</span><span class="cx"> self._logDiffError("attendeeMerge: Could not derive instance for uncancelled component: %s" % (key,))
</span><span class="lines">@@ -426,7 +426,7 @@
</span><span class="cx"> # We used to generate a 403 here - but instead we now ignore this error and let the server data
</span><span class="cx"> # override the client
</span><span class="cx"> self._logDiffError("attendeeMerge: Mismatched calendar objects")
</span><del>- #return False, False, (), None
</del><ins>+ # return False, False, (), None
</ins><span class="cx"> changeCausesReply |= reply
</span><span class="cx"> if reply:
</span><span class="cx"> changedRids.append(rid)
</span><span class="lines">@@ -646,8 +646,8 @@
</span><span class="cx"> duration = component.getProperty("DURATION")
</span><span class="cx">
</span><span class="cx"> timeRange = Period(
</span><del>- start=dtstart.value() if dtstart is not None else None,
- end=dtend.value() if dtend is not None else None,
</del><ins>+ start=dtstart.value() if dtstart is not None else None,
+ end=dtend.value() if dtend is not None else None,
</ins><span class="cx"> duration=duration.value() if duration is not None else None,
</span><span class="cx"> )
</span><span class="cx"> newdue = None
</span><span class="lines">@@ -658,7 +658,7 @@
</span><span class="cx">
</span><span class="cx"> if dtstart or duration:
</span><span class="cx"> timeRange = Period(
</span><del>- start=dtstart.value() if dtstart is not None else None,
</del><ins>+ start=dtstart.value() if dtstart is not None else None,
</ins><span class="cx"> duration=duration.value() if duration is not None else None,
</span><span class="cx"> )
</span><span class="cx"> else:
</span><span class="lines">@@ -737,7 +737,7 @@
</span><span class="cx"> return partstatChanged
</span><span class="cx">
</span><span class="cx">
</span><del>- def whatIsDifferent(self):
</del><ins>+ def whatIsDifferent(self, isiTip=True):
</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">@@ -766,7 +766,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)
</del><ins>+ self._diffComponents(component1, component2, rids, isiTip)
</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">@@ -774,7 +774,7 @@
</span><span class="cx"> newcomponent = self.newcalendar.deriveInstance(key[2])
</span><span class="cx"> if newcomponent is None:
</span><span class="cx"> continue
</span><del>- self._diffComponents(oldcomponent, newcomponent, rids)
</del><ins>+ self._diffComponents(oldcomponent, newcomponent, rids, isiTip)
</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="lines">@@ -782,11 +782,45 @@
</span><span class="cx"> if oldcomponent is None:
</span><span class="cx"> continue
</span><span class="cx"> newcomponent = newmap[key]
</span><del>- self._diffComponents(oldcomponent, newcomponent, rids)
</del><ins>+ self._diffComponents(oldcomponent, newcomponent, rids, isiTip)
</ins><span class="cx">
</span><span class="cx"> return rids
</span><span class="cx">
</span><span class="cx">
</span><ins>+ TRPROPS = frozenset((
+ "DTSTART",
+ "DTEND",
+ "DURATION",
+ "DUE",
+ "RECURRENCE-ID",
+ "RRULE",
+ "RDATE",
+ "EXDATE",
+ "STATUS",
+ "TRANSP",
+ "X-APPLE-TRAVEL-START",
+ "X-APPLE-TRAVEL-DURATION",
+ "X-APPLE-TRAVEL-RETURN",
+ "X-APPLE-TRAVEL-RETURN-DURATION",
+ ))
+
+ def timeRangeDifference(self):
+ """
+ Is there a difference between the two components that implies a change to the time or
+ transparency/status of any instance.
+
+ @return: L{True} if there is such a change, L{False} otherwise
+ @rtype: L{bool}
+ """
+
+ for props in self.whatIsDifferent(isiTip=False).values():
+ props = frozenset(props.keys())
+ if props & self.TRPROPS:
+ return True
+ else:
+ return False
+
+
</ins><span class="cx"> def attendeeNeedsAction(self, diffs):
</span><span class="cx"> """
</span><span class="cx"> Given a set of results from L{whatIsDifferent}, determine which recurrence-id's
</span><span class="lines">@@ -856,20 +890,21 @@
</span><span class="cx"> return (date_changed_rids, recurrence_reschedule,)
</span><span class="cx">
</span><span class="cx">
</span><del>- def _componentDuplicateAndNormalize(self, comp):
</del><ins>+ def _componentDuplicateAndNormalize(self, comp, isiTip=True):
</ins><span class="cx"> comp = comp.duplicate()
</span><span class="cx"> comp.normalizePropertyValueLists("EXDATE")
</span><del>- comp.removePropertyParameters("ORGANIZER", ("SCHEDULE-STATUS",))
- comp.removePropertyParameters("ATTENDEE", ("SCHEDULE-STATUS", "SCHEDULE-FORCE-SEND",))
- comp.removePropertyParameters("VOTER", ("SCHEDULE-STATUS", "SCHEDULE-FORCE-SEND",))
</del><span class="cx"> comp.removeAlarms()
</span><span class="cx"> comp.normalizeAll()
</span><span class="cx"> comp.normalizeAttachments()
</span><del>- iTipGenerator.prepareSchedulingMessage(comp, reply=True)
</del><ins>+ if isiTip:
+ comp.removePropertyParameters("ORGANIZER", ("SCHEDULE-STATUS",))
+ comp.removePropertyParameters("ATTENDEE", ("SCHEDULE-STATUS", "SCHEDULE-FORCE-SEND",))
+ comp.removePropertyParameters("VOTER", ("SCHEDULE-STATUS", "SCHEDULE-FORCE-SEND",))
+ iTipGenerator.prepareSchedulingMessage(comp, reply=True)
</ins><span class="cx"> return comp
</span><span class="cx">
</span><span class="cx">
</span><del>- def _diffComponents(self, comp1, comp2, rids):
</del><ins>+ def _diffComponents(self, comp1, comp2, rids, isiTip=True):
</ins><span class="cx">
</span><span class="cx"> assert isinstance(comp1, Component) and isinstance(comp2, Component)
</span><span class="cx">
</span><span class="lines">@@ -878,8 +913,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)
- comp2 = self._componentDuplicateAndNormalize(comp2)
</del><ins>+ comp1 = self._componentDuplicateAndNormalize(comp1, isiTip)
+ comp2 = self._componentDuplicateAndNormalize(comp2, isiTip)
</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 class="lines">@@ -888,7 +923,6 @@
</span><span class="cx"> propsChanged = {}
</span><span class="cx"> for prop in propdiff:
</span><span class="cx"> if prop.name() in (
</span><del>- "TRANSP",
</del><span class="cx"> "DTSTAMP",
</span><span class="cx"> "CREATED",
</span><span class="cx"> "LAST-MODIFIED",
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingprocessingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py (13785 => 13786)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py        2014-07-24 15:55:09 UTC (rev 13785)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py        2014-07-24 15:56:17 UTC (rev 13786)
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx"> self.recipient_calendar_resource = None
</span><span class="cx"> calendar_resource = (yield getCalendarObjectForRecord(self.txn, self.recipient.record, self.uid))
</span><span class="cx"> if calendar_resource:
</span><del>- self.recipient_calendar = (yield calendar_resource.componentForUser(self.recipient.record.uid))
</del><ins>+ self.recipient_calendar = (yield calendar_resource.componentForUser(self.recipient.record.uid)).duplicate()
</ins><span class="cx"> self.recipient_calendar_resource = calendar_resource
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py (13785 => 13786)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/sql.py        2014-07-24 15:55:09 UTC (rev 13785)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py        2014-07-24 15:56:17 UTC (rev 13786)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> from txdav.caldav.datastore.query.filter import Filter
</span><span class="cx"> from txdav.caldav.datastore.query.generator import CalDAVSQLQueryGenerator
</span><span class="cx"> from txdav.caldav.datastore.scheduling.cuaddress import calendarUserFromCalendarUserAddress
</span><ins>+from txdav.caldav.datastore.scheduling.icaldiff import iCalDiff
</ins><span class="cx"> from txdav.caldav.datastore.scheduling.icalsplitter import iCalSplitter
</span><span class="cx"> from txdav.caldav.datastore.scheduling.implicit import ImplicitScheduler
</span><span class="cx"> from txdav.caldav.datastore.scheduling.utils import uidFromCalendarUserAddress
</span><span class="lines">@@ -1490,9 +1491,10 @@
</span><span class="cx"> return Select(
</span><span class="cx"> [co.RESOURCE_NAME],
</span><span class="cx"> From=co,
</span><del>- Where=((co.RECURRANCE_MIN > Parameter("minDate"))
- .Or(co.RECURRANCE_MAX < Parameter("maxDate")))
- .And(co.CALENDAR_RESOURCE_ID == Parameter("resourceID"))
</del><ins>+ Where=(
+ (co.RECURRANCE_MIN > Parameter("minDate"))
+ .Or(co.RECURRANCE_MAX < Parameter("maxDate"))
+ ).And(co.CALENDAR_RESOURCE_ID == Parameter("resourceID"))
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1750,10 +1752,11 @@
</span><span class="cx"> resourceID=child._resourceID
</span><span class="cx"> )
</span><span class="cx">
</span><ins>+ # ===============================================================================
+ # Group sharing
+ # ===============================================================================
</ins><span class="cx">
</span><del>- #===============================================================================
- # Group sharing
- #===============================================================================
</del><ins>+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def reconcileGroupSharee(self, groupUID):
</span><span class="cx"> """
</span><span class="lines">@@ -1775,9 +1778,9 @@
</span><span class="cx"> [bind.HOME_RESOURCE_ID],
</span><span class="cx"> From=bind,
</span><span class="cx"> Where=(bind.CALENDAR_RESOURCE_ID == self._resourceID).And(
</span><del>- (bind.BIND_MODE == _BIND_MODE_GROUP).Or(
- bind.BIND_MODE == _BIND_MODE_GROUP_READ).Or(
- bind.BIND_MODE == _BIND_MODE_GROUP_WRITE)
</del><ins>+ (bind.BIND_MODE == _BIND_MODE_GROUP)
+ .Or(bind.BIND_MODE == _BIND_MODE_GROUP_READ)
+ .Or(bind.BIND_MODE == _BIND_MODE_GROUP_WRITE)
</ins><span class="cx"> )
</span><span class="cx"> )
</span><span class="cx"> )
</span><span class="lines">@@ -1825,7 +1828,7 @@
</span><span class="cx"> rows = yield Select(
</span><span class="cx"> [Count(gs.GROUP_ID)],
</span><span class="cx"> From=gs,
</span><del>- Where=(
</del><ins>+ Where=(
</ins><span class="cx"> gs.GROUP_ID.In(
</span><span class="cx"> Select(
</span><span class="cx"> [gm.GROUP_ID],
</span><span class="lines">@@ -1871,7 +1874,7 @@
</span><span class="cx"> rows = yield Select(
</span><span class="cx"> [Count(gs.GROUP_ID)],
</span><span class="cx"> From=gs,
</span><del>- Where=(
</del><ins>+ Where=(
</ins><span class="cx"> gs.GROUP_ID.In(
</span><span class="cx"> Select(
</span><span class="cx"> [gm.GROUP_ID],
</span><span class="lines">@@ -1957,7 +1960,7 @@
</span><span class="cx"> rows = yield Select(
</span><span class="cx"> [Max(gs.GROUP_BIND_MODE)], # _BIND_MODE_WRITE > _BIND_MODE_READ
</span><span class="cx"> From=gs,
</span><del>- Where=(
</del><ins>+ Where=(
</ins><span class="cx"> gs.GROUP_ID.In(
</span><span class="cx"> Select(
</span><span class="cx"> [gm.GROUP_ID],
</span><span class="lines">@@ -2224,7 +2227,7 @@
</span><span class="cx"> "_created",
</span><span class="cx"> "_modified",
</span><span class="cx"> "_dataversion",
</span><del>- )
</del><ins>+ )
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @property
</span><span class="lines">@@ -2358,22 +2361,19 @@
</span><span class="cx">
</span><span class="cx"> if groupID in groupIDToMembershipHashMap:
</span><span class="cx"> if groupIDToMembershipHashMap[groupID] != membershipHash:
</span><del>- yield Update({
- ga.MEMBERSHIP_HASH: membershipHash,
- },
</del><ins>+ yield Update(
+ {ga.MEMBERSHIP_HASH: membershipHash, },
</ins><span class="cx"> Where=(ga.RESOURCE_ID == self._resourceID).And(
</span><del>- ga.GROUP_ID == groupID
- )
</del><ins>+ ga.GROUP_ID == groupID)
</ins><span class="cx"> ).on(self._txn)
</span><span class="cx"> changed = True
</span><span class="cx"> del groupIDToMembershipHashMap[groupID]
</span><span class="cx"> else:
</span><span class="cx"> yield Insert({
</span><del>- ga.RESOURCE_ID: self._resourceID,
- ga.GROUP_ID: groupID,
- ga.MEMBERSHIP_HASH: membershipHash,
- }
- ).on(self._txn)
</del><ins>+ ga.RESOURCE_ID: self._resourceID,
+ ga.GROUP_ID: groupID,
+ ga.MEMBERSHIP_HASH: membershipHash,
+ }).on(self._txn)
</ins><span class="cx"> changed = True
</span><span class="cx">
</span><span class="cx"> if groupIDToMembershipHashMap:
</span><span class="lines">@@ -2506,7 +2506,7 @@
</span><span class="cx"> "Attendee list size {0} is larger than allowed limit {1}".format(
</span><span class="cx"> attendeeListLength, config.MaxAttendeesPerInstance
</span><span class="cx"> )
</span><del>- )
</del><ins>+ )
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -2523,13 +2523,15 @@
</span><span class="cx"> # Check for an allowed change
</span><span class="cx"> if organizer is None and (
</span><span class="cx"> cutype == "ROOM" and not config.Scheduling.Options.AllowLocationWithoutOrganizer or
</span><del>- cutype == "RESOURCE" and not config.Scheduling.Options.AllowResourceWithoutOrganizer):
</del><ins>+ cutype == "RESOURCE" and not config.Scheduling.Options.AllowResourceWithoutOrganizer
+ ):
</ins><span class="cx"> raise ValidOrganizerError("Organizer required in calendar data for a {0}".format(cutype.lower(),))
</span><span class="cx">
</span><span class="cx"> # Check for tracking the modifier
</span><span class="cx"> if organizer is None and (
</span><span class="cx"> cutype == "ROOM" and config.Scheduling.Options.TrackUnscheduledLocationData or
</span><del>- cutype == "RESOURCE" and config.Scheduling.Options.TrackUnscheduledResourceData):
</del><ins>+ cutype == "RESOURCE" and config.Scheduling.Options.TrackUnscheduledResourceData
+ ):
</ins><span class="cx">
</span><span class="cx"> # Find current principal and update modified by details
</span><span class="cx"> authz = yield self.directoryService().recordWithUID(self.calendar().viewerHome().authzuid().decode("utf-8"))
</span><span class="lines">@@ -2588,7 +2590,7 @@
</span><span class="cx"> "X-CALENDARSERVER-ATTENDEE-COMMENT",
</span><span class="cx"> ))
</span><span class="cx">
</span><del>- if old_has_private_comments and not new_has_private_comments:
</del><ins>+ if old_has_private_comments and not new_has_private_comments and internal_state == ComponentUpdateState.NORMAL:
</ins><span class="cx"> # Transfer old comments to new calendar
</span><span class="cx"> log.debug("Organizer private comment properties were entirely removed by the client. Restoring existing properties.")
</span><span class="cx"> old_calendar = (yield self.componentForUser())
</span><span class="lines">@@ -2813,12 +2815,16 @@
</span><span class="cx"> "X-APPLE-RADIUS": "71",
</span><span class="cx"> "X-TITLE": title,
</span><span class="cx"> }
</span><del>- structured = Property("X-APPLE-STRUCTURED-LOCATION",
</del><ins>+ structured = Property(
+ "X-APPLE-STRUCTURED-LOCATION",
</ins><span class="cx"> geo.encode("utf-8"), params=params,
</span><del>- valuetype=Value.VALUETYPE_URI)
</del><ins>+ valuetype=Value.VALUETYPE_URI
+ )
</ins><span class="cx"> sub.replaceProperty(structured)
</span><del>- newLocProperty = Property("LOCATION",
- "{0}\n{1}".format(title, street.encode("utf-8")))
</del><ins>+ newLocProperty = Property(
+ "LOCATION",
+ "{0}\n{1}".format(title, street.encode("utf-8"))
+ )
</ins><span class="cx"> sub.replaceProperty(newLocProperty)
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -3125,6 +3131,14 @@
</span><span class="cx"> if did_implicit_action:
</span><span class="cx"> self._componentChanged = True
</span><span class="cx">
</span><ins>+ if not hasattr(self, "tr_change"):
+ if inserting or hasattr(component, "noInstanceIndexing") or not config.FreeBusyIndexSmartUpdate:
+ self.tr_change = None
+ else:
+ oldcomponent = yield self.componentForUser()
+ self.tr_change = iCalDiff(oldcomponent, component, False).timeRangeDifference()
+
+
</ins><span class="cx"> # Always do the per-user data merge right before we store
</span><span class="cx"> component = (yield self.mergePerUserData(component, inserting))
</span><span class="cx">
</span><span class="lines">@@ -3162,8 +3176,10 @@
</span><span class="cx"> category = ChangeCategory.inbox
</span><span class="cx"> elif internal_state == ComponentUpdateState.ORGANIZER_ITIP_UPDATE:
</span><span class="cx"> category = ChangeCategory.organizerITIPUpdate
</span><del>- elif (internal_state == ComponentUpdateState.ATTENDEE_ITIP_UPDATE and
- hasattr(self._txn, "doing_attendee_refresh")):
</del><ins>+ elif (
+ internal_state == ComponentUpdateState.ATTENDEE_ITIP_UPDATE and
+ hasattr(self._txn, "doing_attendee_refresh")
+ ):
</ins><span class="cx"> category = ChangeCategory.attendeeITIPUpdate
</span><span class="cx">
</span><span class="cx"> yield self._calendar.notifyChanged(category=category)
</span><span class="lines">@@ -3201,7 +3217,12 @@
</span><span class="cx"> # In some cases there is no need to remove/rebuild the instance index because we know no time or
</span><span class="cx"> # freebusy related properties have changed (e.g. an attendee reply and refresh). In those cases
</span><span class="cx"> # the component will have a special attribute present to let us know to suppress the instance indexing.
</span><del>- instanceIndexingRequired = not getattr(component, "noInstanceIndexing", False) or inserting or reCreate
</del><ins>+ if inserting or reCreate:
+ instanceIndexingRequired = True
+ elif getattr(component, "noInstanceIndexing", False):
+ instanceIndexingRequired = False
+ else:
+ instanceIndexingRequired = getattr(self, "tr_change", True) in (None, True)
</ins><span class="cx"> instances = None
</span><span class="cx">
</span><span class="cx"> if instanceIndexingRequired:
</span><span class="lines">@@ -3276,7 +3297,7 @@
</span><span class="cx">
</span><span class="cx"> # Now coerce indexing to off if needed
</span><span class="cx"> if not doInstanceIndexing:
</span><del>- #instances = None # used by removeOldEventGroupLink() call at end
</del><ins>+ # instances = None # used by removeOldEventGroupLink() call at end
</ins><span class="cx"> recurrenceLowerLimit = None
</span><span class="cx"> recurrenceLimit = DateTime(1900, 1, 1, 0, 0, 0, tzid=Timezone(utc=True))
</span><span class="cx">
</span><span class="lines">@@ -3514,8 +3535,8 @@
</span><span class="cx"> self.log.error(
</span><span class="cx"> "Calendar data id={0} had unfixable problems:\n {1}".format(
</span><span class="cx"> self._resourceID, "\n ".join(unfixed),
</span><del>- )
</del><span class="cx"> )
</span><ins>+ )
</ins><span class="cx">
</span><span class="cx"> if fixed:
</span><span class="cx"> self.log.error(
</span><span class="lines">@@ -3695,8 +3716,7 @@
</span><span class="cx"> txn = txn if txn is not None else self._txn
</span><span class="cx">
</span><span class="cx"> rMin, rMax = (
</span><del>- yield self._recurrenceMinMaxByIDQuery.on(txn,
- resourceID=self._resourceID)
</del><ins>+ yield self._recurrenceMinMaxByIDQuery.on(txn, resourceID=self._resourceID)
</ins><span class="cx"> )[0]
</span><span class="cx"> returnValue((
</span><span class="cx"> parseSQLDateToPyCalendar(rMin) if rMin is not None else None,
</span><span class="lines">@@ -4535,7 +4555,7 @@
</span><span class="cx"> returnValue(None)
</span><span class="cx">
</span><span class="cx"> # Check it is still split-able
</span><del>- will = (yield cobj.willSplit())
</del><ins>+ will = (yield cobj.willSplit())
</ins><span class="cx">
</span><span class="cx"> if will:
</span><span class="cx"> # Now do the spitting
</span><span class="lines">@@ -4606,8 +4626,7 @@
</span><span class="cx"> # prevented from committing successfully. It's not valid to have an
</span><span class="cx"> # attachment that doesn't point to a real file.
</span><span class="cx">
</span><del>- home = (yield self._txn.calendarHomeWithResourceID(
- self._attachment._ownerHomeID))
</del><ins>+ home = (yield self._txn.calendarHomeWithResourceID(self._attachment._ownerHomeID))
</ins><span class="cx">
</span><span class="cx"> oldSize = self._attachment.size()
</span><span class="cx"> newSize = self._file.tell()
</span><span class="lines">@@ -4691,7 +4710,7 @@
</span><span class="cx"> att = schema.ATTACHMENT
</span><span class="cx"> if self._dropboxID:
</span><span class="cx"> where = (att.DROPBOX_ID == self._dropboxID).And(
</span><del>- att.PATH == self._name)
</del><ins>+ att.PATH == self._name)
</ins><span class="cx"> else:
</span><span class="cx"> where = (att.ATTACHMENT_ID == self._attachmentID)
</span><span class="cx"> rows = (yield Select(
</span><span class="lines">@@ -5399,7 +5418,7 @@
</span><span class="cx"> yield Delete(
</span><span class="cx"> From=attco,
</span><span class="cx"> Where=(attco.ATTACHMENT_ID == self._attachmentID).And(
</span><del>- attco.CALENDAR_OBJECT_RESOURCE_ID == resourceID),
</del><ins>+ attco.CALENDAR_OBJECT_RESOURCE_ID == resourceID),
</ins><span class="cx"> ).on(self._txn)
</span><span class="cx">
</span><span class="cx"> # References still exist - if not remove actual attachment
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoretesttest_sqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py (13785 => 13786)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py        2014-07-24 15:55:09 UTC (rev 13785)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py        2014-07-24 15:56:17 UTC (rev 13786)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> from txdav.caldav.datastore.scheduling.itip import iTIPRequestStatus
</span><span class="cx"> from txdav.caldav.datastore.scheduling.processing import ImplicitProcessor
</span><span class="cx"> from txdav.caldav.datastore.scheduling.scheduler import ScheduleResponseQueue
</span><del>-from txdav.caldav.datastore.sql import CalendarStoreFeatures
</del><ins>+from txdav.caldav.datastore.sql import CalendarStoreFeatures, CalendarObject
</ins><span class="cx"> from txdav.common.datastore.sql import ECALENDARTYPE, CommonObjectResource, \
</span><span class="cx"> CommonStoreTransactionMonitor
</span><span class="cx"> from txdav.common.datastore.sql_tables import schema, _BIND_MODE_DIRECT, \
</span><span class="lines">@@ -192,8 +192,7 @@
</span><span class="cx"> toHome = yield self.transactionUnderTest().calendarHomeWithUID(
</span><span class="cx"> "new-home", create=True)
</span><span class="cx"> toCalendar = yield toHome.calendarWithName("calendar")
</span><del>- ok, bad = (yield _migrateCalendar(fromCalendar, toCalendar,
- lambda x: x.component()))
</del><ins>+ ok, bad = (yield _migrateCalendar(fromCalendar, toCalendar, lambda x: x.component()))
</ins><span class="cx"> self.assertEqual(ok, 1)
</span><span class="cx"> self.assertEqual(bad, 2)
</span><span class="cx">
</span><span class="lines">@@ -212,8 +211,7 @@
</span><span class="cx"> toHome = yield self.transactionUnderTest().calendarHomeWithUID(
</span><span class="cx"> "new-home", create=True)
</span><span class="cx"> toCalendar = yield toHome.calendarWithName("calendar")
</span><del>- ok, bad = (yield _migrateCalendar(fromCalendar, toCalendar,
- lambda x: x.component()))
</del><ins>+ ok, bad = (yield _migrateCalendar(fromCalendar, toCalendar, lambda x: x.component()))
</ins><span class="cx"> self.assertEqual(ok, 3)
</span><span class="cx"> self.assertEqual(bad, 0)
</span><span class="cx">
</span><span class="lines">@@ -400,8 +398,7 @@
</span><span class="cx"> toHome = yield self.transactionUnderTest().calendarHomeWithUID(
</span><span class="cx"> "home_attachments", create=True)
</span><span class="cx"> toCalendar = yield toHome.calendarWithName("calendar")
</span><del>- ok, bad = (yield _migrateCalendar(fromCalendar, toCalendar,
- lambda x: x.component()))
</del><ins>+ ok, bad = (yield _migrateCalendar(fromCalendar, toCalendar, lambda x: x.component()))
</ins><span class="cx"> self.assertEqual(ok, 3)
</span><span class="cx"> self.assertEqual(bad, 0)
</span><span class="cx">
</span><span class="lines">@@ -421,14 +418,14 @@
</span><span class="cx"> lambda x: x.component())
</span><span class="cx">
</span><span class="cx"> filter = caldavxml.Filter(
</span><del>- caldavxml.ComponentFilter(
- caldavxml.ComponentFilter(
- caldavxml.TimeRange(start="%(now)s0201T000000Z" % self.nowYear, end="%(now)s0202T000000Z" % self.nowYear),
- name=("VEVENT", "VFREEBUSY", "VAVAILABILITY"),
- ),
- name="VCALENDAR",
- )
- )
</del><ins>+ caldavxml.ComponentFilter(
+ caldavxml.ComponentFilter(
+ caldavxml.TimeRange(start="%(now)s0201T000000Z" % self.nowYear, end="%(now)s0202T000000Z" % self.nowYear),
+ name=("VEVENT", "VFREEBUSY", "VAVAILABILITY"),
+ ),
+ name="VCALENDAR",
+ )
+ )
</ins><span class="cx"> filter = Filter(filter)
</span><span class="cx"> filter.settimezone(None)
</span><span class="cx">
</span><span class="lines">@@ -640,8 +637,7 @@
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def _defer1():
</span><del>- yield cal1.createObjectResourceWithName("1.ics", Component.fromString(
-"""BEGIN:VCALENDAR
</del><ins>+ yield cal1.createObjectResourceWithName("1.ics", Component.fromString("""BEGIN:VCALENDAR
</ins><span class="cx"> VERSION:2.0
</span><span class="cx"> PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
</span><span class="cx"> CALSCALE:GREGORIAN
</span><span class="lines">@@ -686,8 +682,7 @@
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def _defer2():
</span><del>- yield cal2.createObjectResourceWithName("2.ics", Component.fromString(
-"""BEGIN:VCALENDAR
</del><ins>+ yield cal2.createObjectResourceWithName("2.ics", Component.fromString("""BEGIN:VCALENDAR
</ins><span class="cx"> VERSION:2.0
</span><span class="cx"> PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
</span><span class="cx"> CALSCALE:GREGORIAN
</span><span class="lines">@@ -768,7 +763,7 @@
</span><span class="cx"> txn2 = calendarStore.newTransaction()
</span><span class="cx">
</span><span class="cx"> notification_uid1_1 = yield txn1.notificationsWithUID(
</span><del>- "uid1",
</del><ins>+ "uid1",
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -813,9 +808,11 @@
</span><span class="cx"> yield self.commit()
</span><span class="cx">
</span><span class="cx"> prop = schema.RESOURCE_PROPERTY
</span><del>- _allWithID = Select([prop.NAME, prop.VIEWER_UID, prop.VALUE],
- From=prop,
- Where=prop.RESOURCE_ID == Parameter("resourceID"))
</del><ins>+ _allWithID = Select(
+ [prop.NAME, prop.VIEWER_UID, prop.VALUE],
+ From=prop,
+ Where=prop.RESOURCE_ID == Parameter("resourceID")
+ )
</ins><span class="cx">
</span><span class="cx"> # Check that one property is present
</span><span class="cx"> home = yield self.homeUnderTest()
</span><span class="lines">@@ -859,9 +856,11 @@
</span><span class="cx"> resourceID = calobject._resourceID
</span><span class="cx">
</span><span class="cx"> prop = schema.RESOURCE_PROPERTY
</span><del>- _allWithID = Select([prop.NAME, prop.VIEWER_UID, prop.VALUE],
- From=prop,
- Where=prop.RESOURCE_ID == Parameter("resourceID"))
</del><ins>+ _allWithID = Select(
+ [prop.NAME, prop.VIEWER_UID, prop.VALUE],
+ From=prop,
+ Where=prop.RESOURCE_ID == Parameter("resourceID")
+ )
</ins><span class="cx">
</span><span class="cx"> # No properties on existing calendar object
</span><span class="cx"> rows = yield _allWithID.on(self.transactionUnderTest(), resourceID=resourceID)
</span><span class="lines">@@ -912,9 +911,11 @@
</span><span class="cx"> yield self.commit()
</span><span class="cx">
</span><span class="cx"> prop = schema.RESOURCE_PROPERTY
</span><del>- _allWithID = Select([prop.NAME, prop.VIEWER_UID, prop.VALUE],
- From=prop,
- Where=prop.RESOURCE_ID == Parameter("resourceID"))
</del><ins>+ _allWithID = Select(
+ [prop.NAME, prop.VIEWER_UID, prop.VALUE],
+ From=prop,
+ Where=prop.RESOURCE_ID == Parameter("resourceID")
+ )
</ins><span class="cx">
</span><span class="cx"> # One property exists calendar object
</span><span class="cx"> rows = yield _allWithID.on(self.transactionUnderTest(), resourceID=resourceID)
</span><span class="lines">@@ -1502,6 +1503,7 @@
</span><span class="cx"> # Re-add event with re-indexing
</span><span class="cx"> calendar = yield self.calendarUnderTest()
</span><span class="cx"> calendarObject = yield self.calendarObjectUnderTest(name="indexing.ics")
</span><ins>+ calendarObject.tr_change = True
</ins><span class="cx"> yield calendarObject.setComponent(component)
</span><span class="cx"> instances2 = yield calendarObject.instances()
</span><span class="cx"> self.assertNotEqual(
</span><span class="lines">@@ -1933,8 +1935,10 @@
</span><span class="cx"> rev = calendar._revisionsSchema
</span><span class="cx"> yield Delete(
</span><span class="cx"> From=rev,
</span><del>- Where=(rev.HOME_RESOURCE_ID == Parameter("homeID")).And(
- rev.COLLECTION_NAME == Parameter("collectionName"))
</del><ins>+ Where=(
+ rev.HOME_RESOURCE_ID == Parameter("homeID")).And(
+ rev.COLLECTION_NAME == Parameter("collectionName")
+ )
</ins><span class="cx"> ).on(self.transactionUnderTest(), homeID=home.id(), collectionName="calendar")
</span><span class="cx">
</span><span class="cx"> yield self.commit()
</span><span class="lines">@@ -2430,28 +2434,41 @@
</span><span class="cx"> """.replace("\n", "\r\n")
</span><span class="cx">
</span><span class="cx"> calendar = yield self.calendarUnderTest(name="calendar", home="user01")
</span><del>- yield calendar.createCalendarObjectWithName("structured.ics",
- Component.fromString(data))
- cobj = yield self.calendarObjectUnderTest(name="structured.ics",
- calendar_name="calendar", home="user01")
</del><ins>+ yield calendar.createCalendarObjectWithName(
+ "structured.ics",
+ Component.fromString(data)
+ )
+ cobj = yield self.calendarObjectUnderTest(
+ name="structured.ics",
+ calendar_name="calendar",
+ home="user01"
+ )
</ins><span class="cx"> comp = yield cobj.component()
</span><span class="cx"> components = list(comp.subcomponents())
</span><span class="cx">
</span><span class="cx"> # Check first component
</span><span class="cx"> locProp = components[0].getProperty("LOCATION")
</span><del>- self.assertEquals(locProp.value(),
- "Room with Address 1\n1 Infinite Loop, Cupertino, CA 95014")
</del><ins>+ self.assertEquals(
+ locProp.value(),
+ "Room with Address 1\n1 Infinite Loop, Cupertino, CA 95014"
+ )
</ins><span class="cx"> structProp = components[0].getProperty("X-APPLE-STRUCTURED-LOCATION")
</span><del>- self.assertEquals(structProp.value(),
- "geo:37.331741,-122.030333")
</del><ins>+ self.assertEquals(
+ structProp.value(),
+ "geo:37.331741,-122.030333"
+ )
</ins><span class="cx">
</span><span class="cx"> # Check second component
</span><span class="cx"> locProp = components[1].getProperty("LOCATION")
</span><del>- self.assertEquals(locProp.value(),
- "Room with Address 2\n2 Infinite Loop, Cupertino, CA 95014")
</del><ins>+ self.assertEquals(
+ locProp.value(),
+ "Room with Address 2\n2 Infinite Loop, Cupertino, CA 95014"
+ )
</ins><span class="cx"> structProp = components[1].getProperty("X-APPLE-STRUCTURED-LOCATION")
</span><del>- self.assertEquals(structProp.value(),
- "geo:37.332633,-122.030502")
</del><ins>+ self.assertEquals(
+ structProp.value(),
+ "geo:37.332633,-122.030502"
+ )
</ins><span class="cx">
</span><span class="cx"> yield self.commit()
</span><span class="cx">
</span><span class="lines">@@ -2484,10 +2501,15 @@
</span><span class="cx"> self.patch(config.HostedStatus, "Enabled", True)
</span><span class="cx">
</span><span class="cx"> calendar = yield self.calendarUnderTest(name="calendar", home="user01")
</span><del>- yield calendar.createCalendarObjectWithName("external.ics",
- Component.fromString(data))
- cobj = yield self.calendarObjectUnderTest(name="external.ics",
- calendar_name="calendar", home="user01")
</del><ins>+ yield calendar.createCalendarObjectWithName(
+ "external.ics",
+ Component.fromString(data)
+ )
+ cobj = yield self.calendarObjectUnderTest(
+ name="external.ics",
+ calendar_name="calendar",
+ home="user01"
+ )
</ins><span class="cx"> comp = yield cobj.component()
</span><span class="cx"> components = list(comp.subcomponents())
</span><span class="cx">
</span><span class="lines">@@ -6976,3 +6998,571 @@
</span><span class="cx"> self.assertEqual(normalize_iCalStr(ical_future), normalize_iCalStr(data_future2) % relsubs, "Failed future: %s" % (title,))
</span><span class="cx"> self.assertEqual(normalize_iCalStr(ical_past), normalize_iCalStr(data_past2) % relsubs, "Failed past: %s" % (title,))
</span><span class="cx"> self.assertEqual(normalize_iCalStr(ical_inbox), normalize_iCalStr(data_inbox2) % relsubs, "Failed inbox: %s" % (title,))
</span><ins>+
+
+
+class TimeRangeUpdateOptimization(CommonCommonTests, unittest.TestCase):
+ """
+ CalendarObject splitting tests
+ """
+
+ EVENT1 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+END:VEVENT
+END:VCALENDAR
+"""
+
+ EVENT2 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event #2
+DTSTAMP:20100203T013909Z
+END:VEVENT
+END:VCALENDAR
+"""
+
+ EVENT3 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T130000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+END:VEVENT
+END:VCALENDAR
+"""
+
+ EVENT4 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+TRANSP:TRANSPARENT
+END:VEVENT
+END:VCALENDAR
+"""
+
+ EVENT5 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+STATUS:CANCELLED
+DTSTAMP:20100203T013909Z
+END:VEVENT
+END:VCALENDAR
+"""
+
+ EVENT6 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT1H
+END:VEVENT
+END:VCALENDAR
+"""
+
+ EVENT7 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+RRULE:FREQ=DAILY
+END:VEVENT
+END:VCALENDAR
+"""
+
+ EVENT8 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+RRULE:FREQ=DAILY;COUNT=10
+END:VEVENT
+END:VCALENDAR
+"""
+
+ EVENT9 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+RRULE:FREQ=DAILY
+EXDATE:{now}T120000Z
+END:VEVENT
+END:VCALENDAR
+"""
+
+ EVENT10 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+RRULE:FREQ=DAILY
+RDATE:{now}T150000Z
+END:VEVENT
+END:VCALENDAR
+"""
+
+
+ @inlineCallbacks
+ def setUp(self):
+ yield super(TimeRangeUpdateOptimization, self).setUp()
+ yield self.buildStoreAndDirectory()
+ yield self.populate()
+
+ self.now = DateTime.getNowUTC()
+ self.now.setDateOnly(True)
+
+ self.trcount = 0
+ base_addInstances = CalendarObject._addInstances
+ def __addInstances(*args):
+ self.trcount += 1
+ return base_addInstances(*args)
+ self.patch(CalendarObject, "_addInstances", __addInstances)
+
+ self.patch(config, "FreeBusyIndexDelayedExpand", False)
+ self.patch(config, "FreeBusyIndexSmartUpdate", True)
+
+
+ @inlineCallbacks
+ def populate(self):
+ yield populateCalendarsFrom(self.requirements, self.storeUnderTest())
+ self.notifierFactory.reset()
+
+
+ @property
+ def requirements(self):
+ return {
+ "home1": {
+ "calendar_1": {},
+ },
+ "user01": {
+ "calendar": {},
+ "inbox": {},
+ },
+ "user02": {
+ "calendar": {},
+ "inbox": {},
+ },
+ }
+
+
+ @inlineCallbacks
+ def test_initalPUT(self):
+ """
+ Test that initial PUT causes a TIME_RANGE update
+ """
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT1.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+
+ @inlineCallbacks
+ def test_updatePUT_withoutTRChange(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT1.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+ # Second PUT does not cause T-R change
+ cobj = yield self.calendarObjectUnderTest()
+ yield cobj.setComponent(Component.fromString(self.EVENT2.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+
+ @inlineCallbacks
+ def test_updatePUT_withoutOptimization(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ self.patch(config, "FreeBusyIndexSmartUpdate", False)
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT1.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+ # Second PUT does cause T-R change
+ cobj = yield self.calendarObjectUnderTest()
+ yield cobj.setComponent(Component.fromString(self.EVENT2.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 2)
+
+
+ @inlineCallbacks
+ def test_updatePUT_withTRChange(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT1.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+ # Second PUT causes T-R change
+ cobj = yield self.calendarObjectUnderTest()
+ yield cobj.setComponent(Component.fromString(self.EVENT3.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 2)
+
+
+ @inlineCallbacks
+ def test_updatePUT_withTranspChange(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT1.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+ # Second PUT causes T-R change
+ cobj = yield self.calendarObjectUnderTest()
+ yield cobj.setComponent(Component.fromString(self.EVENT4.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 2)
+
+
+ @inlineCallbacks
+ def test_updatePUT_withStatusChange(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT1.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+ # Second PUT causes T-R change
+ cobj = yield self.calendarObjectUnderTest()
+ yield cobj.setComponent(Component.fromString(self.EVENT5.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 2)
+
+
+ @inlineCallbacks
+ def test_updatePUT_withTravelTimeChange(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT1.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+ # Second PUT causes T-R change
+ cobj = yield self.calendarObjectUnderTest()
+ yield cobj.setComponent(Component.fromString(self.EVENT6.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 2)
+
+
+ @inlineCallbacks
+ def test_updatePUT_withRRULEChange(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT7.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+ # Second PUT causes T-R change
+ cobj = yield self.calendarObjectUnderTest()
+ yield cobj.setComponent(Component.fromString(self.EVENT8.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 2)
+
+
+ @inlineCallbacks
+ def test_updatePUT_withEXDATEAdd(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT7.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+ # Second PUT causes T-R change
+ cobj = yield self.calendarObjectUnderTest()
+ yield cobj.setComponent(Component.fromString(self.EVENT9.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 2)
+
+
+ @inlineCallbacks
+ def test_updatePUT_withRDATEAdd(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest()
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.EVENT7.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 1)
+
+ # Second PUT causes T-R change
+ cobj = yield self.calendarObjectUnderTest()
+ yield cobj.setComponent(Component.fromString(self.EVENT10.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 2)
+
+
+ INVITE1 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+ORGANIZER:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user01@example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02@example.com
+END:VEVENT
+END:VCALENDAR
+"""
+
+ INVITE2 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event
+DTSTAMP:20100203T013909Z
+ORGANIZER:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+END:VEVENT
+END:VCALENDAR
+"""
+
+ INVITE3 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T120000Z
+DURATION:PT1H
+SUMMARY:New Event #2
+DTSTAMP:20100203T013909Z
+ORGANIZER:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+END:VEVENT
+END:VCALENDAR
+"""
+
+ INVITE4 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20100203T013849Z
+UID:uid1
+DTSTART:{now}T140000Z
+DURATION:PT1H
+SUMMARY:New Event #2
+DTSTAMP:20100203T013909Z
+ORGANIZER:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user01@example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02@example.com
+END:VEVENT
+END:VCALENDAR
+"""
+
+ @inlineCallbacks
+ def test_schedulingPUT(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ # Need schedule-q off for this test
+ self.patch(config.Scheduling.Options.WorkQueues, "Enabled", False)
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest(home="user01", name="calendar")
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.INVITE1.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 3)
+
+ # Attendee reply does not cause T-R change (except for inbox item and attendee resource transp change)
+ cal = yield self.calendarUnderTest(home="user02", name="calendar")
+ cobjs = yield cal.calendarObjects()
+ self.assertEqual(len(cobjs), 1)
+ yield cobjs[0].setComponent(Component.fromString(self.INVITE2.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 5)
+
+ # Organizer summary change does not cause T-R change (except for inbox item)
+ cobj = yield self.calendarObjectUnderTest(home="user01", calendar_name="calendar")
+ yield cobj.setComponent(Component.fromString(self.INVITE3.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 6)
+
+ # Organizer dtstart change causes T-R change
+ cobj = yield self.calendarObjectUnderTest(home="user01", calendar_name="calendar")
+ yield cobj.setComponent(Component.fromString(self.INVITE4.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 9)
+
+
+ @inlineCallbacks
+ def test_schedulingPUT_withoutOptimization(self):
+ """
+ Test that second PUT withe time change causes a TIME_RANGE update
+ """
+
+ self.patch(config, "FreeBusyIndexSmartUpdate", False)
+
+ # Need schedule-q off for this test
+ self.patch(config.Scheduling.Options.WorkQueues, "Enabled", False)
+
+ # First PUT causes T-R change
+ cal = yield self.calendarUnderTest(home="user01", name="calendar")
+ yield cal.createObjectResourceWithName("1.ics", Component.fromString(self.INVITE1.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 3)
+
+ # Attendee reply does cause T-R change (except for organizer update)
+ cal = yield self.calendarUnderTest(home="user02", name="calendar")
+ cobjs = yield cal.calendarObjects()
+ self.assertEqual(len(cobjs), 1)
+ yield cobjs[0].setComponent(Component.fromString(self.INVITE2.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 5)
+
+ # Organizer summary change causes T-R change
+ cobj = yield self.calendarObjectUnderTest(home="user01", calendar_name="calendar")
+ yield cobj.setComponent(Component.fromString(self.INVITE3.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 8)
+
+ # Organizer dtstart change causes T-R change
+ cobj = yield self.calendarObjectUnderTest(home="user01", calendar_name="calendar")
+ yield cobj.setComponent(Component.fromString(self.INVITE4.format(now=self.now.getText())))
+ yield self.commit()
+
+ self.assertEqual(self.trcount, 11)
</ins></span></pre>
</div>
</div>
</body>
</html>