[CalendarServer-changes] [13117] CalendarServer/branches/users/sagen/move2who-4/txdav/who

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 2 07:47:00 PDT 2014


Revision: 13117
          http://trac.calendarserver.org//changeset/13117
Author:   sagen at apple.com
Date:     2014-04-02 07:47:00 -0700 (Wed, 02 Apr 2014)
Log Message:
-----------
Handle a UUID value in recordsMatchingFields

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py
    CalendarServer/branches/users/sagen/move2who-4/txdav/who/test/test_directory.py

Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py	2014-04-02 14:46:19 UTC (rev 13116)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py	2014-04-02 14:47:00 UTC (rev 13117)
@@ -151,6 +151,8 @@
                     fieldName=fieldName
                 )
                 continue
+            if self.fieldName.valueType(field) is uuid.UUID and isinstance(searchTerm, unicode):
+                searchTerm = uuid.UUID(searchTerm)
             subExpression = MatchExpression(
                 field,
                 searchTerm,

Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/test/test_directory.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/test/test_directory.py	2014-04-02 14:46:19 UTC (rev 13116)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/test/test_directory.py	2014-04-02 14:47:00 UTC (rev 13117)
@@ -111,3 +111,15 @@
         )
         records = yield self.directory.recordsFromExpression(expression)
         self.assertEquals(len(records), 1)
+
+
+    @inlineCallbacks
+    def test_recordsFromMatchExpressionNonUnicode(self):
+        expression = MatchExpression(
+            FieldName.guid,
+            UUID("6423F94A-6B76-4A3A-815B-D52CFD77935D"),
+            MatchType.equals,
+            MatchFlags.caseInsensitive
+        )
+        records = yield self.directory.recordsFromExpression(expression)
+        self.assertEquals(len(records), 1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140402/fdd0468c/attachment.html>


More information about the calendarserver-changes mailing list