[CalendarServer-changes] [10660] CalendarServer/trunk/twext/who

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 7 17:05:55 PST 2013


Revision: 10660
          http://trac.calendarserver.org//changeset/10660
Author:   wsanchez at apple.com
Date:     2013-02-07 17:05:55 -0800 (Thu, 07 Feb 2013)
Log Message:
-----------
Don't need inlineCallbacks; just return the deferred.

Modified Paths:
--------------
    CalendarServer/trunk/twext/who/directory.py
    CalendarServer/trunk/twext/who/xml.py

Modified: CalendarServer/trunk/twext/who/directory.py
===================================================================
--- CalendarServer/trunk/twext/who/directory.py	2013-02-08 00:52:10 UTC (rev 10659)
+++ CalendarServer/trunk/twext/who/directory.py	2013-02-08 01:05:55 UTC (rev 10660)
@@ -65,6 +65,11 @@
 
 
     def recordsFromExpression(self, expression):
+        """
+        Finds records matching a single expression.
+        @param expression: an expression
+        @type expression: L{object}
+        """
         return fail(QueryNotSupportedError("Unknown expression: %s" % (expression,)))
 
 

Modified: CalendarServer/trunk/twext/who/xml.py
===================================================================
--- CalendarServer/trunk/twext/who/xml.py	2013-02-08 00:52:10 UTC (rev 10659)
+++ CalendarServer/trunk/twext/who/xml.py	2013-02-08 01:05:55 UTC (rev 10660)
@@ -315,6 +315,12 @@
 
 
     def indexedRecordsFromMatchExpression(self, expression):
+        """
+        Finds records in the internal indexes matching a single
+        expression.
+        @param expression: an expression
+        @type expression: L{object}
+        """
         if expression.matchType != MatchType.equals:
             raise NotImplementedError("Handle MatchType != equals")
 
@@ -324,17 +330,25 @@
         return succeed(self.index[expression.fieldName].get(expression.fieldValue, ()))
 
 
-    @inlineCallbacks
+    def unIndexedRecordsFromMatchExpression(self, expression):
+        """
+        Finds records not in the internal indexes matching a single
+        expression.
+        @param expression: an expression
+        @type expression: L{object}
+        """
+        raise NotImplementedError("Handle unindexed fields")
+
     def recordsFromExpression(self, expression):
         if isinstance(expression, DirectoryQueryMatchExpression):
             if expression.fieldName in self.indexedFields:
-                returnValue((yield self.indexedRecordsFromMatchExpression(expression)))
-
-            raise NotImplementedError("Handle unindexed field")
-
+                records = self.indexedRecordsFromMatchExpression(expression)
+            else:
+                records = self.unIndexedRecordsFromMatchExpression(expression)
         else:
-            returnValue((yield BaseDirectoryService.recordsFromExpression(self, expression)))
+            records = BaseDirectoryService.recordsFromExpression(self, expression)
 
+        return records
 
 
 class DirectoryRecord(BaseDirectoryRecord):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130207/bb699b7a/attachment.html>


More information about the calendarserver-changes mailing list