[CalendarServer-changes] [8865] CalendarServer/trunk/calendarserver/tools/shell/vfs.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 14 00:18:02 PDT 2012


Revision: 8865
          http://trac.macosforge.org/projects/calendarserver/changeset/8865
Author:   wsanchez at apple.com
Date:     2012-03-14 00:18:02 -0700 (Wed, 14 Mar 2012)
Log Message:
-----------
Add describe() to PrincipalHomeFolder

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-03-14 07:17:26 UTC (rev 8864)
+++ CalendarServer/trunk/calendarserver/tools/shell/vfs.py	2012-03-14 07:18:02 UTC (rev 8865)
@@ -296,7 +296,47 @@
     def list(self):
         return Folder.list(self)
 
+    def describe(self):
+        result = []
+        result.append("Principal home for UID: %s\n" % (self.uid,))
 
+        if self.record is not None:
+            rows = []
+
+            def add(name, value):
+                if value:
+                    rows.append((name, value))
+
+            add("Service"    , self.record.service   )
+            add("Record Type", self.record.recordType)
+
+            for shortName in self.record.shortNames:
+                add("Short Name", shortName)
+
+            add("GUID"      , self.record.guid     )
+            add("Full Name" , self.record.fullName )
+            add("First Name", self.record.firstName)
+            add("Last Name" , self.record.lastName )
+
+            for email in self.record.emailAddresses:
+                add("Email Address", email)
+
+            for cua in self.record.calendarUserAddresses:
+                add("Calendar User Address", cua)
+
+            add("Server ID"           , self.record.serverID              )
+            add("Partition ID"        , self.record.partitionID           )
+            add("Enabled"             , self.record.enabled               )
+            add("Enabled for Calendar", self.record.enabledForCalendaring )
+            add("Enabled for Contacts", self.record.enabledForAddressBooks)
+
+            if rows:
+                result.append("Directory Record:")
+                result.append(tableString(rows, header=("Name", "Value")))
+
+        return "\n".join(result)
+
+
 class CalendarHomeFolder(Folder):
     """
     Calendar home folder.
@@ -333,7 +373,7 @@
         properties   = (yield self.home.properties())
 
         result = []
-        result.append("Calendar home for UID: %s" % (uid,))
+        result.append("Calendar home for UID: %s\n" % (uid,))
 
         #
         # Attributes
@@ -353,14 +393,14 @@
             ))
 
         if len(rows):
-            result.append("\nAttributes:")
+            result.append("Attributes:")
             result.append(tableString(rows, header=("Name", "Value")))
 
         #
         # Properties
         #
         if properties:
-            result.append("\Properties:")
+            result.append("Properties:")
             result.append(tableString(
                 ((name, properties[name]) for name in sorted(properties)),
                 header=("Name", "Value")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120314/0685556c/attachment.html>


More information about the calendarserver-changes mailing list