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

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 21 19:09:29 PST 2013


Revision: 10794
          http://trac.calendarserver.org//changeset/10794
Author:   wsanchez at apple.com
Date:     2013-02-21 19:09:29 -0800 (Thu, 21 Feb 2013)
Log Message:
-----------
util tests

Modified Paths:
--------------
    CalendarServer/trunk/twext/who/test/test_aggregate.py
    CalendarServer/trunk/twext/who/test/test_directory.py
    CalendarServer/trunk/twext/who/test/test_xml.py
    CalendarServer/trunk/twext/who/util.py

Modified: CalendarServer/trunk/twext/who/test/test_aggregate.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_aggregate.py	2013-02-22 02:46:13 UTC (rev 10793)
+++ CalendarServer/trunk/twext/who/test/test_aggregate.py	2013-02-22 03:09:29 UTC (rev 10794)
@@ -15,7 +15,7 @@
 ##
 
 """
-Aggregate directory service tests
+Aggregate directory service tests.
 """
 
 from twisted.python.components import proxyForInterface

Modified: CalendarServer/trunk/twext/who/test/test_directory.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_directory.py	2013-02-22 02:46:13 UTC (rev 10793)
+++ CalendarServer/trunk/twext/who/test/test_directory.py	2013-02-22 03:09:29 UTC (rev 10794)
@@ -15,7 +15,7 @@
 ##
 
 """
-Generic directory service base implementation tests
+Generic directory service base implementation tests.
 """
 
 from zope.interface.verify import verifyObject, BrokenMethodImplementation

Modified: CalendarServer/trunk/twext/who/test/test_xml.py
===================================================================
--- CalendarServer/trunk/twext/who/test/test_xml.py	2013-02-22 02:46:13 UTC (rev 10793)
+++ CalendarServer/trunk/twext/who/test/test_xml.py	2013-02-22 03:09:29 UTC (rev 10794)
@@ -15,7 +15,7 @@
 ##
 
 """
-XML directory service tests
+XML directory service tests.
 """
 
 from time import sleep

Modified: CalendarServer/trunk/twext/who/util.py
===================================================================
--- CalendarServer/trunk/twext/who/util.py	2013-02-22 02:46:13 UTC (rev 10793)
+++ CalendarServer/trunk/twext/who/util.py	2013-02-22 03:09:29 UTC (rev 10794)
@@ -37,7 +37,7 @@
     def __init__(self, constants):
         myConstants = {}
         for constant in constants:
-            if hasattr(self, constant.name):
+            if constant.name in myConstants:
                 raise ValueError("Name conflict: %r" % (constant.name,))
             myConstants[constant.name] = constant
 
@@ -45,7 +45,7 @@
 
     def __getattr__(self, name):
         try:
-            return self.lookupByName(name)
+            return self._constants[name]
         except KeyError:
             raise AttributeError(name)
 
@@ -53,10 +53,12 @@
         return self._constants.itervalues()
 
     def lookupByName(self, name):
-        return self._constants[name]
+        try:
+            return self._constants[name]
+        except KeyError:
+            raise ValueError(name)
 
 
-
 def uniqueResult(values):
     result = None
     for value in values:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130221/6274d412/attachment.html>


More information about the calendarserver-changes mailing list