[CalendarServer-changes] [12887] twext/trunk/twext/who/opendirectory

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 14:22:57 PDT 2014


Revision: 12887
          http://trac.calendarserver.org//changeset/12887
Author:   sagen at apple.com
Date:     2014-03-12 14:22:57 -0700 (Wed, 12 Mar 2014)
Log Message:
-----------
Set recordType properly in _queryFromMatchExpression

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

Modified: twext/trunk/twext/who/opendirectory/_service.py
===================================================================
--- twext/trunk/twext/who/opendirectory/_service.py	2014-03-12 21:14:36 UTC (rev 12886)
+++ twext/trunk/twext/who/opendirectory/_service.py	2014-03-12 21:22:57 UTC (rev 12887)
@@ -416,7 +416,7 @@
             if recordType is None:
                 recordTypes = [t.value for t in ODRecordType.iterconstants()]
             else:
-                recordTypes = recordType
+                recordTypes = ODRecordType.fromRecordType(recordType).value
 
             queryAttribute = ODAttribute.fromFieldName(
                 expression.fieldName

Modified: twext/trunk/twext/who/opendirectory/test/test_service.py
===================================================================
--- twext/trunk/twext/who/opendirectory/test/test_service.py	2014-03-12 21:14:36 UTC (rev 12886)
+++ twext/trunk/twext/who/opendirectory/test/test_service.py	2014-03-12 21:22:57 UTC (rev 12887)
@@ -35,6 +35,22 @@
     Tests for L{DirectoryService}.
     """
 
+    def test_queryFromMatchExpression_recordType(self):
+        """
+        Make sure queryFromMatchExpression handles recordType correctly
+        """
+        service = DirectoryService()
+        query = service._queryFromMatchExpression(
+            MatchExpression(
+                service.fieldName.shortNames, u"xyzzy"
+            ),
+            recordType=service.recordType.group
+        )
+        # FIXME:
+        # Actually, how do we inspect the query object to peek at the
+        # recordType that got set?
+
+
     def test_queryStringFromMatchExpression_matchTypes(self):
         """
         Match expressions with each match type produces the correct
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/dadaaf44/attachment.html>


More information about the calendarserver-changes mailing list