[CalendarServer-changes] [9748] CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/ls.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Aug 27 07:31:36 PDT 2012
Revision: 9748
http://trac.macosforge.org/projects/calendarserver/changeset/9748
Author: cdaboo at apple.com
Date: 2012-08-27 07:31:35 -0700 (Mon, 27 Aug 2012)
Log Message:
-----------
Add some more options to display resource type and supported components.
Modified Paths:
--------------
CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/ls.py
Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/ls.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/ls.py 2012-08-25 14:28:52 UTC (rev 9747)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/ls.py 2012-08-27 14:31:35 UTC (rev 9748)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2007-2010 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.
@@ -16,7 +16,7 @@
from caldavclientlibrary.browser.command import Command
from caldavclientlibrary.browser.command import WrongOptions
-from caldavclientlibrary.protocol.caldav.definitions import csxml
+from caldavclientlibrary.protocol.caldav.definitions import csxml, caldavxml
from caldavclientlibrary.protocol.webdav.definitions import davxml
from caldavclientlibrary.protocol.url import URL
import os
@@ -33,12 +33,14 @@
longlist = False
path = None
+ rtype = False
displayname = False
ctag = False
etag = False
+ supported_components = False
synctoken = False
- opts, args = getopt.getopt(shlex.split(options), 'acdels')
+ opts, args = getopt.getopt(shlex.split(options), 'acdeilrs')
for name, _ignore_value in opts:
@@ -53,8 +55,14 @@
elif name == "-e":
etag = True
longlist = True
+ elif name == "-i":
+ supported_components = True
+ longlist = True
elif name == "-l":
longlist = True
+ elif name == "-r":
+ rtype = True
+ longlist = True
elif name == "-s":
synctoken = True
longlist = True
@@ -84,6 +92,8 @@
props += (csxml.getctag,)
if etag:
props += (davxml.getetag,)
+ if supported_components:
+ props += (caldavxml.supported_calendar_component_set,)
if synctoken:
props += (davxml.synctoken,)
results = self.shell.account.session.getPropertiesOnHierarchy(resource, props)
@@ -103,12 +113,19 @@
modtime = props.get(davxml.getlastmodified, "-")
line.append(modtime)
line.append(rurl[len(path):])
+ if rtype:
+ if isinstance(props.get(davxml.resourcetype), str):
+ line.append("type:-")
+ else:
+ line.append("type:%s" % (",".join([child.tag.split("}")[1] for child in props.get(davxml.resourcetype).getchildren()])))
if displayname:
line.append("name:'%s'" % (props.get(davxml.displayname, '-'),))
if ctag:
line.append("ctag:'%s'" % (props.get(csxml.getctag, '-'),))
if etag:
line.append("etag:'%s'" % (props.get(davxml.getetag, '-'),))
+ if supported_components and props.get(caldavxml.supported_calendar_component_set) is not None:
+ line.append("comp:%s" % (",".join([child.get("name", "") for child in props.get(caldavxml.supported_calendar_component_set).getchildren()])))
if synctoken:
line.append("sync:'%s'" % (props.get(davxml.synctoken, '-'),))
else:
@@ -143,7 +160,9 @@
-c long listing + CS:getctag
-d long listing + DAV:displayname
-e long listing + DAV:getetag
+-i long listing + CALDAV:supported-calendar-component-set
-l long listing
+-r long listing + DAV:resourcetype
-s long listing + DAV:sync-token
""" % (name,)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120827/7a4fcfed/attachment.html>
More information about the calendarserver-changes
mailing list