[CalendarServer-changes] [11930] CalendarServer/trunk/twext/who
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:21:16 PDT 2014
Revision: 11930
http://trac.calendarserver.org//changeset/11930
Author: wsanchez at apple.com
Date: 2013-11-08 17:47:01 -0800 (Fri, 08 Nov 2013)
Log Message:
-----------
docs
Modified Paths:
--------------
CalendarServer/trunk/twext/who/directory.py
CalendarServer/trunk/twext/who/index.py
Modified: CalendarServer/trunk/twext/who/directory.py
===================================================================
--- CalendarServer/trunk/twext/who/directory.py 2013-11-09 01:24:57 UTC (rev 11929)
+++ CalendarServer/trunk/twext/who/directory.py 2013-11-09 01:47:01 UTC (rev 11930)
@@ -136,7 +136,6 @@
narrowed down results to a set of records.
That is, it's a performance optimization; ignoring this and
searching the entire directory will also work.
-
@type records: L{set} or L{frozenset}
@return: The matching records.
Modified: CalendarServer/trunk/twext/who/index.py
===================================================================
--- CalendarServer/trunk/twext/who/index.py 2013-11-09 01:24:57 UTC (rev 11929)
+++ CalendarServer/trunk/twext/who/index.py 2013-11-09 01:47:01 UTC (rev 11930)
@@ -81,12 +81,21 @@
@property
def index(self):
+ """
+ Call L{loadRecords}C{()} and return the index.
+ """
self.loadRecords()
return self._index
@index.setter
def index(self, value):
+ """
+ Sets the index.
+
+ @param index: An index.
+ @type index: L{dict}
+ """
self._index = value
@@ -105,7 +114,17 @@
@staticmethod
- def _queryFlags(flags):
+ def _matchFlags(flags):
+ """
+ Compute a predicate and normalize functions for the given match
+ expression flags.
+
+ @param flags: Match expression flags.
+ @type flags: L{MatchFlags}
+
+ @return: Predicate and normalize functions.
+ @rtype: L{tuple} of callables.
+ """
predicate = lambda x: x
normalize = lambda x: x
@@ -125,12 +144,19 @@
def indexedRecordsFromMatchExpression(self, expression, records=None):
"""
- Finds records in the internal indexes matching a single
- expression.
- @param expression: an expression
+ Finds records in the internal indexes matching a single expression.
+
+ @param expression: An expression.
@type expression: L{object}
+
+ @param records: a set of records to limit the search to. C{None} if
+ the whole directory should be searched.
+ @type records: L{set} or L{frozenset}
+
+ @return: The matching records.
+ @rtype: deferred iterable of L{DirectoryRecord}s
"""
- predicate, normalize = self._queryFlags(expression.flags)
+ predicate, normalize = self._matchFlags(expression.flags)
fieldIndex = self.index[expression.fieldName]
matchValue = normalize(expression.fieldValue)
@@ -171,12 +197,19 @@
def unIndexedRecordsFromMatchExpression(self, expression, records=None):
"""
- Finds records not in the internal indexes matching a single
- expression.
- @param expression: an expression
+ Finds records not in the internal indexes matching a single expression.
+
+ @param expression: An expression.
@type expression: L{object}
+
+ @param records: a set of records to limit the search to. C{None} if
+ the whole directory should be searched.
+ @type records: L{set} or L{frozenset}
+
+ @return: The matching records.
+ @rtype: deferred iterable of L{DirectoryRecord}s
"""
- predicate, normalize = self._queryFlags(expression.flags)
+ predicate, normalize = self._matchFlags(expression.flags)
matchValue = normalize(expression.fieldValue)
matchType = expression.matchType
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/03f8b8f3/attachment.html>
More information about the calendarserver-changes
mailing list