[CalendarServer-changes] [13535] twext/trunk/twext/who/opendirectory/_service.py

source_changes at macosforge.org source_changes at macosforge.org
Tue May 27 10:18:51 PDT 2014


Revision: 13535
          http://trac.calendarserver.org//changeset/13535
Author:   sagen at apple.com
Date:     2014-05-27 10:18:51 -0700 (Tue, 27 May 2014)
Log Message:
-----------
Keep recordTypes a set until we actually need to turn it into a list

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

Modified: twext/trunk/twext/who/opendirectory/_service.py
===================================================================
--- twext/trunk/twext/who/opendirectory/_service.py	2014-05-24 20:49:31 UTC (rev 13534)
+++ twext/trunk/twext/who/opendirectory/_service.py	2014-05-27 17:18:51 UTC (rev 13535)
@@ -297,8 +297,8 @@
         @param recordTypes: allowed OD record type strings
         @type recordTypes: set(C{unicode})
 
-        @return: tuple(OD query string, list(query's OD record type strings))
-        @rtype: (C{unicode}, list(C{unicode}))
+        @return: tuple(OD query string, set(query's OD record type strings))
+        @rtype: (C{unicode}, set(C{unicode}))
         """
         if recordTypes is None:
             recordTypes = set([t.value for t in ODRecordType.iterconstants()])
@@ -346,13 +346,13 @@
                 queryTokens[:0] = (u"(")
                 queryTokens.append(u")")
 
-        return (u"".join(queryTokens), list(recordTypes))
+        return (u"".join(queryTokens), recordTypes)
 
 
     def _queryStringAndRecordTypesFromExpression(
         self,
         expression,
-        recordTypes=[t.value for t in ODRecordType.iterconstants()]
+        recordTypes=set([t.value for t in ODRecordType.iterconstants()])
     ):
         """
         Converts either a MatchExpression or a CompoundExpression into an LDAP
@@ -364,8 +364,8 @@
         @param recordTypes: allowed OD record type strings
         @type recordTypes: set(C{unicode})
 
-        @return: tuple(OD query string, list(query's OD record type strings))
-        @rtype: (C{unicode}, list(C{unicode}))
+        @return: tuple(OD query string, set(query's OD record type strings))
+        @rtype: (C{unicode}, set(C{unicode}))
         """
 
         if isinstance(expression, MatchExpression):
@@ -420,7 +420,7 @@
 
         query, error = ODQuery.queryWithNode_forRecordTypes_attribute_matchType_queryValues_returnAttributes_maximumResults_error_(
             node,
-            recordTypes,
+            list(recordTypes),
             None,
             matchType,
             queryString,
@@ -496,7 +496,7 @@
                 expression.fieldValue
             ).value
             if MatchFlags.NOT in flags:
-                recordTypes = (
+                recordTypes = list(
                     set([t.value for t in ODRecordType.iterconstants()]) -
                     recordTypes
                 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140527/db91a790/attachment.html>


More information about the calendarserver-changes mailing list