[CalendarServer-changes] [13680] CalendarServer/trunk/twistedcaldav/directory/util.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 24 09:55:58 PDT 2014


Revision: 13680
          http://trac.calendarserver.org//changeset/13680
Author:   sagen at apple.com
Date:     2014-06-24 09:55:58 -0700 (Tue, 24 Jun 2014)
Log Message:
-----------
Handle missing shortNames

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/util.py

Modified: CalendarServer/trunk/twistedcaldav/directory/util.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/util.py	2014-06-24 08:35:55 UTC (rev 13679)
+++ CalendarServer/trunk/twistedcaldav/directory/util.py	2014-06-24 16:55:58 UTC (rev 13680)
@@ -39,6 +39,7 @@
 
 log = Logger()
 
+
 def uuidFromName(namespace, name):
     """
     Generate a version 5 (SHA-1) UUID from a namespace UUID and a name.
@@ -69,6 +70,7 @@
 
 TRANSACTION_KEY = '_newStoreTransaction'
 
+
 def transactionFromRequest(request, newStore):
     """
     Return the associated transaction from the given HTTP request, creating a
@@ -97,6 +99,7 @@
         else:
             authz_uid = None
         transaction = newStore.newTransaction(repr(request), authz_uid=authz_uid)
+
         def abortIfUncommitted(request, response):
             try:
                 # TODO: missing 'yield' here.  For formal correctness as per
@@ -186,7 +189,11 @@
                 record = principal.parent.record
             except:
                 return None
-        return (record.recordType, record.shortNames[0])
+        try:
+            shortName = record.shortNames[0]
+        except AttributeError:
+            shortName = u""
+        return (record.recordType, shortName)
 
 
     def describe(principal):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140624/bfaf50ae/attachment-0001.html>


More information about the calendarserver-changes mailing list