[CalendarServer-changes] [12346] twext/trunk/twext/who/ldap

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:21:49 PDT 2014


Revision: 12346
          http://trac.calendarserver.org//changeset/12346
Author:   wsanchez at apple.com
Date:     2014-01-14 17:16:42 -0800 (Tue, 14 Jan 2014)
Log Message:
-----------
Get rid of who_uid constant.

Modified Paths:
--------------
    twext/trunk/twext/who/ldap/_constants.py
    twext/trunk/twext/who/ldap/_service.py
    twext/trunk/twext/who/ldap/test/test_service.py

Modified: twext/trunk/twext/who/ldap/_constants.py
===================================================================
--- twext/trunk/twext/who/ldap/_constants.py	2014-01-15 00:55:34 UTC (rev 12345)
+++ twext/trunk/twext/who/ldap/_constants.py	2014-01-15 01:16:42 UTC (rev 12346)
@@ -251,7 +251,6 @@
     """
     Attributes needed internally that have no standard name.
     """
-    who_uid = ValueConstant(u"__who_uid__")
     generatedUUID = ValueConstant(u"entryUUID")
     objectClass = ValueConstant(u"objectClass")
     mail = ValueConstant(u"mail")

Modified: twext/trunk/twext/who/ldap/_service.py
===================================================================
--- twext/trunk/twext/who/ldap/_service.py	2014-01-15 00:55:34 UTC (rev 12345)
+++ twext/trunk/twext/who/ldap/_service.py	2014-01-15 01:16:42 UTC (rev 12346)
@@ -50,9 +50,7 @@
 
 
 # Maps field name -> LDAP attribute name
-# FIXME: Use constants
 DEFAULT_FIELDNAME_MAP = {
-    BaseFieldName.uid: LDAPAttribute.who_uid.value,
     BaseFieldName.guid: LDAPAttribute.generatedUUID.value,
     BaseFieldName.recordType: LDAPAttribute.objectClass.value,
     BaseFieldName.shortNames: LDAPAttribute.uid.value,

Modified: twext/trunk/twext/who/ldap/test/test_service.py
===================================================================
--- twext/trunk/twext/who/ldap/test/test_service.py	2014-01-15 00:55:34 UTC (rev 12345)
+++ twext/trunk/twext/who/ldap/test/test_service.py	2014-01-15 01:16:42 UTC (rev 12346)
@@ -44,6 +44,12 @@
 )
 
 
+
+TEST_FIELDNAME_MAP = dict(DEFAULT_FIELDNAME_MAP)
+TEST_FIELDNAME_MAP[BaseFieldName.uid] = u"__who_uid__"
+
+
+
 class BaseTestCase(object):
     """
     Tests for L{DirectoryService}.
@@ -74,7 +80,12 @@
 
 
     def service(self, **kwargs):
-        return DirectoryService(url=self.url, baseDN=self.baseDN, **kwargs)
+        return DirectoryService(
+            url=self.url,
+            baseDN=self.baseDN,
+            fieldNameToAttributeMap=TEST_FIELDNAME_MAP,
+            **kwargs
+        )
 
 
 
@@ -225,7 +236,7 @@
         return unicode(obj)
 
     def tuplify(record, fieldName):
-        name = DEFAULT_FIELDNAME_MAP.get(fieldName, fieldName.name)
+        name = TEST_FIELDNAME_MAP.get(fieldName, fieldName.name)
 
         if fieldName is BaseFieldName.recordType:
             value = DEFAULT_RECORDTYPE_MAP[record.fields[fieldName]]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/36cb30c3/attachment.html>


More information about the calendarserver-changes mailing list