[CalendarServer-changes] [8987] CalendarServer/trunk/calendarserver/tools/shell/vfs.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Apr 5 12:45:13 PDT 2012
Revision: 8987
http://trac.macosforge.org/projects/calendarserver/changeset/8987
Author: wsanchez at apple.com
Date: 2012-04-05 12:45:12 -0700 (Thu, 05 Apr 2012)
Log Message:
-----------
Truncate property values with newlines.
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 18:52:39 UTC (rev 8986)
+++ CalendarServer/trunk/calendarserver/tools/shell/vfs.py 2012-04-05 19:45:12 UTC (rev 8987)
@@ -495,9 +495,10 @@
properties = (yield self.home.properties())
if properties:
result.append("Properties:")
- result.append(tableString(
- ((name.toString(), properties[name]) for name in sorted(properties))
- ))
+ result.append(tableString((
+ (name.toString(), truncateAtNewline(properties[name]))
+ for name in sorted(properties)
+ )))
returnValue("\n".join(result))
@@ -637,9 +638,10 @@
properties = (yield self.object.properties())
if properties:
result.append("Properties:")
- result.append(tableString(
- ((name.toString(), properties[name]) for name in sorted(properties))
- ))
+ result.append(tableString((
+ (name.toString(), properties[name])
+ for name in sorted(properties)
+ )))
returnValue("\n".join(description))
@@ -673,3 +675,13 @@
return "(unknown)"
return strftime("%a, %d %b %Y %H:%M:%S %z(%Z)", localtime(time))
+
+
+def truncateAtNewline(text):
+ text = str(text)
+ try:
+ index = text.index("\n")
+ except ValueError:
+ return text
+
+ return text[:index] + "..."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120405/d7202a03/attachment-0001.html>
More information about the calendarserver-changes
mailing list