[CalendarServer-changes] [11757]

source_changes at macosforge.org source_changes at macosforge.org
Wed Sep 25 13:45:07 PDT 2013


Revision: 11757
          http://trac.calendarserver.org//changeset/11757
Author:   gaya at apple.com
Date:     2013-09-25 13:45:07 -0700 (Wed, 25 Sep 2013)
Log Message:
-----------
All depth 1 sync report with sync token revision < bind revision

Modified Paths:
--------------
    CalDAVTester/branches/users/gaya/sharedgroupfixestester/scripts/tests/CardDAV/sharing-sync.xml
    CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/carddav/datastore/sql.py

Modified: CalDAVTester/branches/users/gaya/sharedgroupfixestester/scripts/tests/CardDAV/sharing-sync.xml
===================================================================
--- CalDAVTester/branches/users/gaya/sharedgroupfixestester/scripts/tests/CardDAV/sharing-sync.xml	2013-09-25 10:16:21 UTC (rev 11756)
+++ CalDAVTester/branches/users/gaya/sharedgroupfixestester/scripts/tests/CardDAV/sharing-sync.xml	2013-09-25 20:45:07 UTC (rev 11757)
@@ -2982,7 +2982,7 @@
 				</grabelement>
 			</request>
 		</test>
-		<test name='3' ignore='yes'>
+		<test name='3' ignore='no'>
 			<description>add addressbook - test last sync</description>
 			<description>share user3 address book with user1</description>
 			<description>user3 POSTs invitation</description>
@@ -3025,7 +3025,7 @@
 				<ruri>$addressbookhome1:/</ruri>
 				<header>
 					<name>Depth</name>
-					<value>infinity</value>
+					<value>1</value>
 				</header>
 				<data>
 					<content-type>text/xml; charset=utf-8</content-type>
@@ -3040,14 +3040,14 @@
 				</verify>
 			</request>
 		</test>
-		<test name='4' ignore='yes'>
+		<test name='4' ignore='no'>
 			<description>add addressbook - test previous sync</description>
 			<request print-response='no'>
 				<method>REPORT</method>
 				<ruri>$addressbookhome1:/</ruri>
 				<header>
 					<name>Depth</name>
-					<value>infinity</value>
+					<value>1</value>
 				</header>
 				<data>
 					<content-type>text/xml; charset=utf-8</content-type>

Modified: CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/carddav/datastore/sql.py	2013-09-25 10:16:21 UTC (rev 11756)
+++ CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/carddav/datastore/sql.py	2013-09-25 20:45:07 UTC (rev 11757)
@@ -568,18 +568,22 @@
         print("sharedChildResourceNamesSinceRevision:%s revision:%s, depth:%s self._bindRevision=%s" % (self, revision, depth, self._bindRevision))
         assert not self.owned()
 
-        if self.fullyShared() and revision != 0 and revision < self._bindRevision:
-            print("sharedChildResourceNamesSinceRevision:%s RAISE revision=%s < self._revision=%s" % (self, revision, self._bindRevision))
-            raise SyncTokenValidException
+        bindRevisions = [self._bindRevision] if self.fullyShared() else []
 
         groupBindRows = yield AddressBookObject._acceptedBindForHomeIDAndAddressBookID.on(
                 self._txn, homeID=self._home._resourceID, addressbookID=self._resourceID
         )
-        print("sharedChildResourceNamesSinceRevision:%s maxGroupBindRevision:%s" % (self, max([groupBindRow[5] for groupBindRow in groupBindRows]) if groupBindRows else None))
-        if groupBindRows and revision != 0 and revision < max([groupBindRow[5] for groupBindRow in groupBindRows]):
-            print("sharedChildResourceNamesSinceRevision:%s RAISE revision=%s < max([groupBindRow[5] for groupBindRow in groupBindRows]=%s)" % (self, revision, [groupBindRow[5] for groupBindRow in groupBindRows]))
-            raise SyncTokenValidException
+        if groupBindRows:
+            bindRevisions += [groupBindRow[5] for groupBindRow in groupBindRows]
 
+        if revision != 0 and revision < max(bindRevisions):
+            if depth == "1":
+                revision = 0
+            else:
+                print("sharedChildResourceNamesSinceRevision:%s RAISE revision=%s < max([groupBindRow[5] for groupBindRow in groupBindRows]=%s)" % (self, revision, [groupBindRow[5] for groupBindRow in groupBindRows]))
+                # perhaps we could return a multistatus result of 403 instead: TODO: Check RFC
+                raise SyncTokenValidException
+
         if self.fullyShared():
             returnValue((yield super(AddressBook, self).sharedChildResourceNamesSinceRevision(revision, depth)))
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130925/98665a24/attachment.html>


More information about the calendarserver-changes mailing list