[CalendarServer-changes] [9265] CalDAVClientLibrary/trunk/caldavclientlibrary

source_changes at macosforge.org source_changes at macosforge.org
Tue May 22 14:29:28 PDT 2012


Revision: 9265
          http://trac.macosforge.org/projects/calendarserver/changeset/9265
Author:   cdaboo at apple.com
Date:     2012-05-22 14:29:28 -0700 (Tue, 22 May 2012)
Log Message:
-----------
Catch up to final sync REPORT spec changes.

Modified Paths:
--------------
    CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py
    CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/definitions/davxml.py
    CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/synccollection.py

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py	2012-05-22 19:23:22 UTC (rev 9264)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py	2012-05-22 21:29:28 UTC (rev 9265)
@@ -505,7 +505,7 @@
         other = set()
 
         # Create WebDAV sync REPORT
-        request = SyncCollection(self, rurl.relativeURL(), headers.Depth1, synctoken, props)
+        request = SyncCollection(self, rurl.relativeURL(), davxml.sync_level_1, synctoken, props)
         result = ResponseDataString()
         request.setOutput(result)
     

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/definitions/davxml.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/definitions/davxml.py	2012-05-22 19:23:22 UTC (rev 9264)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/definitions/davxml.py	2012-05-22 21:29:28 UTC (rev 9265)
@@ -101,3 +101,7 @@
 
 sync_collection = QName(DAVNamespace, "sync-collection")
 sync_token      = QName(DAVNamespace, "sync-token")
+sync_level      = QName(DAVNamespace, "sync-level")
+sync_level_1        = "1"
+sync_level_infinite = "infinite"
+

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/synccollection.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/synccollection.py	2012-05-22 19:23:22 UTC (rev 9264)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/synccollection.py	2012-05-22 21:29:28 UTC (rev 9265)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2007-2011 Apple Inc. All rights reserved.
+# Copyright (c) 2007-2012 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -24,11 +24,11 @@
 
 class SyncCollection(Report):
 
-    def __init__(self, session, url, depth, synctoken, props=()):
-        assert(depth in (headers.Depth0, headers.Depth1, headers.DepthInfinity))
+    def __init__(self, session, url, level, synctoken, props=()):
+        assert(level in (davxml.sync_level_1, davxml.sync_level_infinite,))
 
         super(SyncCollection, self).__init__(session, url)
-        self.depth = depth
+        self.level = level
         self.synctoken = synctoken
         self.props = props
         
@@ -45,13 +45,14 @@
         super(SyncCollection, self).addHeaders(hdrs)
         
         # Add depth header
-        hdrs.append((headers.Depth, self.depth))
+        hdrs.append((headers.Depth, headers.Depth0))
     
     def generateXML(self, os):
         # Structure of document is:
         #
         # <DAV:sync-collection>
         #   <DAV:sync-token>xxx</DAV:sync-token>
+        #   <DAV:sync-level>xxx</DAV:sync-level>
         #   <DAV:prop>
         #     <<names of each property as elements>>
         #   </DAV:prop>
@@ -63,10 +64,13 @@
         # Add sync-token element
         SubElement(synccollection, davxml.sync_token).text = self.synctoken
 
+        # Add sync-token element
+        SubElement(synccollection, davxml.sync_level).text = self.level
+
+        # <DAV:prop> element
+        prop = SubElement(synccollection, davxml.prop)
+
         if self.props:
-            # <DAV:prop> element
-            prop = SubElement(synccollection, davxml.prop)
-            
             # Now add each property
             for propname in self.props:
                 # Add property element taking namespace into account
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120522/2683357e/attachment.html>


More information about the calendarserver-changes mailing list