[CalendarServer-changes] [11191] CalDAVClientLibrary/trunk/caldavclientlibrary
source_changes at macosforge.org
source_changes at macosforge.org
Wed May 15 10:02:51 PDT 2013
Revision: 11191
http://trac.calendarserver.org//changeset/11191
Author: cdaboo at apple.com
Date: 2013-05-15 10:02:51 -0700 (Wed, 15 May 2013)
Log Message:
-----------
Fix up sync command and include depth:infinite option.
Modified Paths:
--------------
CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/sync.py
CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py
CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/propfindparser.py
Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/sync.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/sync.py 2013-05-15 16:47:55 UTC (rev 11190)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/sync.py 2013-05-15 17:02:51 UTC (rev 11191)
@@ -21,7 +21,7 @@
import getopt
import shlex
-synctokens = {}
+synctokens = [{}, {}]
class Cmd(Command):
@@ -33,13 +33,16 @@
def execute(self, cmdname, options):
force = False
+ infinite = False
- opts, args = getopt.getopt(shlex.split(options), 'f')
+ opts, args = getopt.getopt(shlex.split(options), 'fi')
for name, _ignore_value in opts:
if name == "-f":
force = True
+ elif name == "-i":
+ infinite = True
else:
print "Unknown option: %s" % (name,)
print self.usage(cmdname)
@@ -58,9 +61,9 @@
if not path.endswith("/"):
path += "/"
resource = URL(url=path)
- synctoken = synctokens.get(path, "") if not force else ""
- newsyctoken, changed, removed, other = self.shell.account.session.syncCollection(resource, synctoken)
- synctokens[path] = newsyctoken
+ synctoken = synctokens[0 if infinite else 1].get(path, "") if not force else ""
+ newsyctoken, changed, removed, other = self.shell.account.session.syncCollection(resource, synctoken, infinite=infinite)
+ synctokens[0 if infinite else 1][path] = newsyctoken
for item in changed:
print "Changed: %s" % (item,)
@@ -83,6 +86,7 @@
Options:
-f force full sync
+-i depth:infinite [DEFAULT depth:1]
""" % (name,)
Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py 2013-05-15 16:47:55 UTC (rev 11190)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py 2013-05-15 17:02:51 UTC (rev 11191)
@@ -513,7 +513,7 @@
self.handleHTTPError(request)
- def syncCollection(self, rurl, synctoken, props=()):
+ def syncCollection(self, rurl, synctoken, props=(), infinite=False):
assert(isinstance(rurl, URL))
@@ -523,7 +523,7 @@
other = set()
# Create WebDAV sync REPORT
- request = SyncCollection(self, rurl.relativeURL(), davxml.sync_level_1, synctoken, props)
+ request = SyncCollection(self, rurl.relativeURL(), davxml.sync_level_infinite if infinite else davxml.sync_level_1, synctoken, props)
result = ResponseDataString()
request.setOutput(result)
@@ -541,9 +541,9 @@
# Get child element name (decode URL)
name = URL(url=item.getResource(), decode=True)
- if item.status == 404:
+ if int(item.status) == 404:
removed.add(name)
- elif item.status / 100 != 2:
+ elif int(item.status) / 100 != 2:
other.add(name)
else:
changed.add(name)
Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/propfindparser.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/propfindparser.py 2013-05-15 16:47:55 UTC (rev 11190)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/webdav/propfindparser.py 2013-05-15 17:02:51 UTC (rev 11191)
@@ -99,7 +99,7 @@
self.parsePropStat(child, result)
elif child.tag == davxml.status:
- result.setStatus(child.text)
+ result.setStatus(parseStatusLine(child.text))
# Add the resource only if we got one
if result.getResource():
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130515/c4c60a70/attachment.html>
More information about the calendarserver-changes
mailing list