[CalendarServer-changes] [8991] CalendarServer/trunk/calendarserver/tools/shell/vfs.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Apr 5 15:44:54 PDT 2012
Revision: 8991
http://trac.macosforge.org/projects/calendarserver/changeset/8991
Author: wsanchez at apple.com
Date: 2012-04-05 15:44:53 -0700 (Thu, 05 Apr 2012)
Log Message:
-----------
Add describe() to CalendarFolder.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/shell/vfs.py
Modified: CalendarServer/trunk/calendarserver/tools/shell/vfs.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/vfs.py 2012-04-05 21:21:49 UTC (rev 8990)
+++ CalendarServer/trunk/calendarserver/tools/shell/vfs.py 2012-04-05 22:44:53 UTC (rev 8991)
@@ -491,20 +491,15 @@
% (quotaUsed, quotaAllowed, quotaUsed / quotaAllowed)
))
- if len(rows):
- description.append("Attributes:")
- description.append(tableString(rows))
+ description.append("Attributes:")
+ description.append(tableString(rows))
#
# Properties
#
properties = (yield self.home.properties())
if properties:
- description.append("Properties:")
- description.append(tableString((
- (name.toString(), truncateAtNewline(properties[name]))
- for name in sorted(properties)
- )))
+ description.append(tableStringForProperties(properties))
returnValue("\n".join(description))
@@ -544,7 +539,33 @@
returnValue(result)
+ @inlineCallbacks
+ def describe(self):
+ description = ["Calendar:\n"]
+ #
+ # Attributes
+ #
+ ownerHome = (yield self.calendar.ownerCalendarHome()) # FIXME: Translate into human
+ syncToken = (yield self.calendar.syncToken())
+
+ rows = []
+ rows.append(("Owner" , ownerHome))
+ rows.append(("Sync Token", syncToken))
+
+ description.append("Attributes:")
+ description.append(tableString(rows))
+
+ #
+ # Properties
+ #
+ properties = (yield self.calendar.properties())
+ if properties:
+ description.append(tableStringForProperties(properties))
+
+ returnValue("\n".join(description))
+
+
class CalendarObject(File):
"""
Calendar object.
@@ -643,11 +664,7 @@
#
properties = (yield self.object.properties())
if properties:
- description.append("Properties:")
- description.append(tableString((
- (name.toString(), properties[name])
- for name in sorted(properties)
- )))
+ description.append(tableStringForProperties(properties))
returnValue("\n".join(description))
@@ -676,7 +693,13 @@
table.printTable(os=output)
return output.getvalue()
+def tableStringForProperties(properties):
+ return "Properties:\n%s" % (tableString((
+ (name.toString(), truncateAtNewline(properties[name]))
+ for name in sorted(properties)
+ )))
+
def timeString(time):
if time is None:
return "(unknown)"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120405/45b5252b/attachment.html>
More information about the calendarserver-changes
mailing list