[CalendarServer-changes] [10730] CalendarServer/trunk/twext/who

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 14 10:53:12 PST 2013


Revision: 10730
          http://trac.calendarserver.org//changeset/10730
Author:   wsanchez at apple.com
Date:     2013-02-14 10:53:12 -0800 (Thu, 14 Feb 2013)
Log Message:
-----------
cleanup

Modified Paths:
--------------
    CalendarServer/trunk/twext/who/directory.py
    CalendarServer/trunk/twext/who/idirectory.py
    CalendarServer/trunk/twext/who/util.py
    CalendarServer/trunk/twext/who/xml.py

Modified: CalendarServer/trunk/twext/who/directory.py
===================================================================
--- CalendarServer/trunk/twext/who/directory.py	2013-02-14 18:48:22 UTC (rev 10729)
+++ CalendarServer/trunk/twext/who/directory.py	2013-02-14 18:53:12 UTC (rev 10730)
@@ -35,7 +35,7 @@
 from twext.who.idirectory import Operand
 from twext.who.idirectory import DirectoryQueryMatchExpression
 from twext.who.idirectory import IDirectoryService, IDirectoryRecord
-from twext.who.util import uniqueResult
+from twext.who.util import uniqueResult, describe
 
 
 
@@ -198,11 +198,9 @@
 
 
     def __repr__(self):
-        recordType = getattr(self.recordType, "description", self.recordType)
-
         return "<%s (%s)%s>" % (
             self.__class__.__name__,
-            recordType,
+            describe(self.recordType),
             self.shortNames[0],
         )
 

Modified: CalendarServer/trunk/twext/who/idirectory.py
===================================================================
--- CalendarServer/trunk/twext/who/idirectory.py	2013-02-14 18:48:22 UTC (rev 10729)
+++ CalendarServer/trunk/twext/who/idirectory.py	2013-02-14 18:53:12 UTC (rev 10730)
@@ -179,10 +179,7 @@
 
     def __repr__(self):
         def describe(constant):
-            if hasattr(constant, "description"):
-                return constant.description
-            else:
-                return str(constant)
+            return getattr(constant, "description", str(constant))
 
         if self.flags is None:
             flags = ""

Modified: CalendarServer/trunk/twext/who/util.py
===================================================================
--- CalendarServer/trunk/twext/who/util.py	2013-02-14 18:48:22 UTC (rev 10729)
+++ CalendarServer/trunk/twext/who/util.py	2013-02-14 18:53:12 UTC (rev 10730)
@@ -77,8 +77,4 @@
 
 
 def describe(constant):
-    description = getattr(constant, "description", None)
-    if description is None:
-        return str(constant)
-    else:
-        return description
+    return getattr(constant, "description", str(constant))

Modified: CalendarServer/trunk/twext/who/xml.py
===================================================================
--- CalendarServer/trunk/twext/who/xml.py	2013-02-14 18:48:22 UTC (rev 10729)
+++ CalendarServer/trunk/twext/who/xml.py	2013-02-14 18:53:12 UTC (rev 10730)
@@ -39,7 +39,7 @@
 from twext.who.idirectory import DirectoryServiceError
 from twext.who.idirectory import NoSuchRecordError, UnknownRecordTypeError
 from twext.who.idirectory import RecordType, FieldName as BaseFieldName
-from twext.who.idirectory import MatchType, QueryFlags
+from twext.who.idirectory import MatchType
 from twext.who.idirectory import DirectoryQueryMatchExpression
 from twext.who.directory import DirectoryService as BaseDirectoryService
 from twext.who.directory import DirectoryRecord as BaseDirectoryRecord
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130214/467faa42/attachment.html>


More information about the calendarserver-changes mailing list