[CalendarServer-changes] [13292] twext/trunk/twext/who/ldap/_service.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 15 15:33:08 PDT 2014


Revision: 13292
          http://trac.calendarserver.org//changeset/13292
Author:   wsanchez at apple.com
Date:     2014-04-15 15:33:08 -0700 (Tue, 15 Apr 2014)
Log Message:
-----------
minor

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

Modified: twext/trunk/twext/who/ldap/_service.py
===================================================================
--- twext/trunk/twext/who/ldap/_service.py	2014-04-15 22:28:11 UTC (rev 13291)
+++ twext/trunk/twext/who/ldap/_service.py	2014-04-15 22:33:08 UTC (rev 13292)
@@ -478,7 +478,7 @@
 
             fields = {}
 
-            for attribute, value in recordData.iteritems():
+            for attribute, values in recordData.iteritems():
                 fieldNames = self._attributeToFieldNameMap.get(attribute)
 
                 if fieldNames is None:
@@ -493,13 +493,16 @@
                     valueType = self.fieldName.valueType(fieldName)
 
                     if valueType in (unicode, UUID):
-                        if not isinstance(value, list):
-                            value = [value]
-                        newValue = [valueType(v) for v in value]
-                        if not self.fieldName.isMultiValue(fieldName):
-                            newValue = newValue[0]
-                        fields[fieldName] = newValue
+                        if not isinstance(values, list):
+                            values = [values]
 
+                        newValues = [valueType(v) for v in values]
+
+                        if self.fieldName.isMultiValue(fieldName):
+                            fields[fieldName] = newValues
+                        else:
+                            fields[fieldName] = newValues[0]
+
                     else:
                         raise LDAPConfigurationError(
                             "Unknown value type {0} for field {1}".format(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140415/7881d11b/attachment.html>


More information about the calendarserver-changes mailing list