[CalendarServer-changes] [13722] CalendarServer/trunk/calendarserver/tools

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 3 15:21:36 PDT 2014


Revision: 13722
          http://trac.calendarserver.org//changeset/13722
Author:   sagen at apple.com
Date:     2014-07-03 15:21:36 -0700 (Thu, 03 Jul 2014)
Log Message:
-----------
shortnames are optional

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/principals.py
    CalendarServer/trunk/calendarserver/tools/util.py

Modified: CalendarServer/trunk/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/principals.py	2014-07-03 22:20:57 UTC (rev 13721)
+++ CalendarServer/trunk/calendarserver/tools/principals.py	2014-07-03 22:21:36 UTC (rev 13722)
@@ -409,12 +409,15 @@
                 )
             )
             print("   UID: {u}".format(u=record.uid,))
-            print(
-                "   Record name{plural}: {names}".format(
-                    plural=("s" if len(record.shortNames) > 1 else ""),
-                    names=(", ".join(record.shortNames))
+            try:
+                print(
+                    "   Record name{plural}: {names}".format(
+                        plural=("s" if len(record.shortNames) > 1 else ""),
+                        names=(", ".join(record.shortNames))
+                    )
                 )
-            )
+            except AttributeError:
+                pass
             try:
                 if record.emailAddresses:
                     print(

Modified: CalendarServer/trunk/calendarserver/tools/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/util.py	2014-07-03 22:20:57 UTC (rev 13721)
+++ CalendarServer/trunk/calendarserver/tools/util.py	2014-07-03 22:21:36 UTC (rev 13722)
@@ -560,11 +560,15 @@
 
 
 def prettyRecord(record):
+    try:
+        shortNames = record.shortNames
+    except AttributeError:
+        shortNames = []
     return "\"{d}\" {uid} ({rt}) {sn}".format(
         d=record.displayName,
         rt=record.recordType.name,
         uid=record.uid,
-        sn=(", ".join(record.shortNames))
+        sn=(", ".join(shortNames))
     )
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140703/1be89fd7/attachment.html>


More information about the calendarserver-changes mailing list