<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[13949] CalendarServer/trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/13949">13949</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2014-09-10 20:34:30 -0700 (Wed, 10 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Adds support for limiting directory results and timeouts</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkcalendarservertoolsprincipalspy">CalendarServer/trunk/calendarserver/tools/principals.py</a></li>
<li><a href="#CalendarServertrunkrequirementsstabletxt">CalendarServer/trunk/requirements-stable.txt</a></li>
<li><a href="#CalendarServertrunktwistedcaldavextensionspy">CalendarServer/trunk/twistedcaldav/extensions.py</a></li>
<li><a href="#CalendarServertrunktxdavdpsclientpy">CalendarServer/trunk/txdav/dps/client.py</a></li>
<li><a href="#CalendarServertrunktxdavdpscommandspy">CalendarServer/trunk/txdav/dps/commands.py</a></li>
<li><a href="#CalendarServertrunktxdavdpsserverpy">CalendarServer/trunk/txdav/dps/server.py</a></li>
<li><a href="#CalendarServertrunktxdavwhoaugmentpy">CalendarServer/trunk/txdav/who/augment.py</a></li>
<li><a href="#CalendarServertrunktxdavwhocachepy">CalendarServer/trunk/txdav/who/cache.py</a></li>
<li><a href="#CalendarServertrunktxdavwhodelegatespy">CalendarServer/trunk/txdav/who/delegates.py</a></li>
<li><a href="#CalendarServertrunktxdavwhodirectorypy">CalendarServer/trunk/txdav/who/directory.py</a></li>
<li><a href="#CalendarServertrunktxdavwhotesttest_group_attendeespy">CalendarServer/trunk/txdav/who/test/test_group_attendees.py</a></li>
<li><a href="#CalendarServertrunktxdavwhowikipy">CalendarServer/trunk/txdav/who/wiki.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkcalendarservertoolsprincipalspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/calendarserver/tools/principals.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/calendarserver/tools/principals.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/calendarserver/tools/principals.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -523,6 +523,11 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def action_listProxyFor(store, record, *proxyTypes):
</span><span class="cx"> directory = store.directoryService()
</span><ins>+
+ if record.recordType != directory.recordType.user:
+ print("You must pass a user principal to this command")
+ returnValue(None)
+
</ins><span class="cx"> for proxyType in proxyTypes:
</span><span class="cx">
</span><span class="cx"> groupRecordType = {
</span></span></pre></div>
<a id="CalendarServertrunkrequirementsstabletxt"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/requirements-stable.txt (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/requirements-stable.txt        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/requirements-stable.txt        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> # For CalendarServer development, don't try to get these projects from PyPI; use svn.
</span><span class="cx">
</span><span class="cx"> -e .
</span><del>--e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13938#egg=twextpy
</del><ins>+-e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13948#egg=twextpy
</ins><span class="cx"> -e svn+http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk@13420#egg=kerberos
</span><span class="cx"> -e svn+http://svn.calendarserver.org/repository/calendarserver/PyCalendar/trunk@13802#egg=pycalendar
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktwistedcaldavextensionspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/extensions.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/extensions.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/twistedcaldav/extensions.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -230,7 +230,9 @@
</span><span class="cx"> yield dir.recordsMatchingFields(
</span><span class="cx"> fields,
</span><span class="cx"> operand=operand,
</span><del>- recordType=recordType
</del><ins>+ recordType=recordType,
+ limitResults=clientLimit,
+ timeoutSeconds=10
</ins><span class="cx"> )
</span><span class="cx"> )
</span><span class="cx">
</span><span class="lines">@@ -329,7 +331,12 @@
</span><span class="cx"> matchingResources = []
</span><span class="cx"> matchcount = 0
</span><span class="cx">
</span><del>- records = (yield dir.recordsMatchingTokens(tokens, context=context))
</del><ins>+ records = (yield dir.recordsMatchingTokens(
+ tokens,
+ context=context,
+ limitResults=clientLimit,
+ timeoutSeconds=10
+ ))
</ins><span class="cx">
</span><span class="cx"> for record in records:
</span><span class="cx"> resource = yield principalCollection.principalForRecord(record)
</span></span></pre></div>
<a id="CalendarServertrunktxdavdpsclientpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/dps/client.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/dps/client.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/txdav/dps/client.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -242,7 +242,7 @@
</span><span class="cx"> returnValue(postProcess(results))
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordWithShortName(self, recordType, shortName):
</del><ins>+ def recordWithShortName(self, recordType, shortName, timeoutSeconds=None):
</ins><span class="cx"> # MOVE2WHO
</span><span class="cx"> # temporary hack until we can fix all callers not to pass strings:
</span><span class="cx"> if isinstance(recordType, (str, unicode)):
</span><span class="lines">@@ -253,64 +253,110 @@
</span><span class="cx"> # log.warn("Need to change shortName to unicode")
</span><span class="cx"> shortName = shortName.decode("utf-8")
</span><span class="cx">
</span><ins>+ kwds = {
+ "recordType": recordType.name.encode("utf-8"),
+ "shortName": shortName.encode("utf-8")
+ }
+ if timeoutSeconds is not None:
+ kwds["timeoutSeconds"] = timeoutSeconds
+
</ins><span class="cx"> return self._call(
</span><span class="cx"> RecordWithShortNameCommand,
</span><span class="cx"> self._processSingleRecord,
</span><del>- recordType=recordType.name.encode("utf-8"),
- shortName=shortName.encode("utf-8")
</del><ins>+ **kwds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordWithUID(self, uid):
</del><ins>+ def recordWithUID(self, uid, timeoutSeconds=None):
</ins><span class="cx"> # MOVE2WHO, REMOVE THIS:
</span><span class="cx"> if not isinstance(uid, unicode):
</span><span class="cx"> # log.warn("Need to change uid to unicode")
</span><span class="cx"> uid = uid.decode("utf-8")
</span><span class="cx">
</span><ins>+ kwds = {
+ "uid": uid.encode("utf-8"),
+ }
+ if timeoutSeconds is not None:
+ kwds["timeoutSeconds"] = timeoutSeconds
+
</ins><span class="cx"> return self._call(
</span><span class="cx"> RecordWithUIDCommand,
</span><span class="cx"> self._processSingleRecord,
</span><del>- uid=uid.encode("utf-8")
</del><ins>+ **kwds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordWithGUID(self, guid):
</del><ins>+ def recordWithGUID(self, guid, timeoutSeconds=None):
+ kwds = {
+ "guid": str(guid),
+ }
+ if timeoutSeconds is not None:
+ kwds["timeoutSeconds"] = timeoutSeconds
+
</ins><span class="cx"> return self._call(
</span><span class="cx"> RecordWithGUIDCommand,
</span><span class="cx"> self._processSingleRecord,
</span><del>- guid=str(guid)
</del><ins>+ **kwds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordsWithRecordType(self, recordType):
</del><ins>+ def recordsWithRecordType(
+ self, recordType, limitResults=None, timeoutSeconds=None
+ ):
+ kwds = {
+ "recordType": recordType.name.encode("utf-8")
+ }
+ if limitResults is not None:
+ kwds["limitResults"] = limitResults
+ if timeoutSeconds is not None:
+ kwds["timeoutSeconds"] = timeoutSeconds
</ins><span class="cx"> return self._call(
</span><span class="cx"> RecordsWithRecordTypeCommand,
</span><span class="cx"> self._processMultipleRecords,
</span><del>- recordType=recordType.name.encode("utf-8")
</del><ins>+ **kwds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordsWithEmailAddress(self, emailAddress):
</del><ins>+ def recordsWithEmailAddress(
+ self, emailAddress, limitResults=None, timeoutSeconds=None
+ ):
+ kwds = {
+ "emailAddress": emailAddress.encode("utf-8")
+ }
+ if limitResults is not None:
+ kwds["limitResults"] = limitResults
+ if timeoutSeconds is not None:
+ kwds["timeoutSeconds"] = timeoutSeconds
+
</ins><span class="cx"> return self._call(
</span><span class="cx"> RecordsWithEmailAddressCommand,
</span><span class="cx"> self._processMultipleRecords,
</span><del>- emailAddress=emailAddress.encode("utf-8")
</del><ins>+ **kwds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def recordsMatchingTokens(
</span><del>- self, tokens, context=None, limitResults=50, timeoutSeconds=10
</del><ins>+ self, tokens, context=None, limitResults=None, timeoutSeconds=None
</ins><span class="cx"> ):
</span><ins>+ kwds = {
+ "tokens": [t.encode("utf-8") for t in tokens],
+ "context": context
+ }
+ if limitResults is not None:
+ kwds["limitResults"] = limitResults
+ if timeoutSeconds is not None:
+ kwds["timeoutSeconds"] = timeoutSeconds
+
</ins><span class="cx"> return self._call(
</span><span class="cx"> RecordsMatchingTokensCommand,
</span><span class="cx"> self._processMultipleRecords,
</span><del>- tokens=[t.encode("utf-8") for t in tokens],
- context=context
</del><ins>+ **kwds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def recordsMatchingFields(
</span><del>- self, fields, operand=Operand.OR, recordType=None
</del><ins>+ self, fields, operand=Operand.OR, recordType=None,
+ limitResults=None, timeoutSeconds=None
</ins><span class="cx"> ):
</span><span class="cx"> newFields = []
</span><span class="cx"> for fieldName, searchTerm, matchFlags, matchType in fields:
</span><span class="lines">@@ -329,12 +375,21 @@
</span><span class="cx"> if recordType is not None:
</span><span class="cx"> recordType = recordType.name.encode("utf-8")
</span><span class="cx">
</span><ins>+ kwds = {
+ "fields": newFields,
+ "operand": operand.name.encode("utf-8"),
+ "recordType": recordType
+ }
+ if limitResults is not None:
+ kwds["limitResults"] = limitResults
+ if timeoutSeconds is not None:
+ kwds["timeoutSeconds"] = timeoutSeconds
+
+
</ins><span class="cx"> return self._call(
</span><span class="cx"> RecordsMatchingFieldsCommand,
</span><span class="cx"> self._processMultipleRecords,
</span><del>- fields=newFields,
- operand=operand.name.encode("utf-8"),
- recordType=recordType
</del><ins>+ **kwds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavdpscommandspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/dps/commands.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/dps/commands.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/txdav/dps/commands.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> arguments = [
</span><span class="cx"> ('recordType', amp.String()),
</span><span class="cx"> ('shortName', amp.String()),
</span><ins>+ ('timeoutSeconds', amp.Integer(optional=True)),
</ins><span class="cx"> ]
</span><span class="cx"> response = [
</span><span class="cx"> ('fields', amp.String()),
</span><span class="lines">@@ -31,6 +32,7 @@
</span><span class="cx"> class RecordWithUIDCommand(amp.Command):
</span><span class="cx"> arguments = [
</span><span class="cx"> ('uid', amp.String()),
</span><ins>+ ('timeoutSeconds', amp.Integer(optional=True)),
</ins><span class="cx"> ]
</span><span class="cx"> response = [
</span><span class="cx"> ('fields', amp.String()),
</span><span class="lines">@@ -41,6 +43,7 @@
</span><span class="cx"> class RecordWithGUIDCommand(amp.Command):
</span><span class="cx"> arguments = [
</span><span class="cx"> ('guid', amp.String()),
</span><ins>+ ('timeoutSeconds', amp.Integer(optional=True)),
</ins><span class="cx"> ]
</span><span class="cx"> response = [
</span><span class="cx"> ('fields', amp.String()),
</span><span class="lines">@@ -51,6 +54,8 @@
</span><span class="cx"> class RecordsWithRecordTypeCommand(amp.Command):
</span><span class="cx"> arguments = [
</span><span class="cx"> ('recordType', amp.String()),
</span><ins>+ ('limitResults', amp.Integer(optional=True)),
+ ('timeoutSeconds', amp.Integer(optional=True)),
</ins><span class="cx"> ]
</span><span class="cx"> response = [
</span><span class="cx"> ('items', amp.ListOf(amp.String())),
</span><span class="lines">@@ -62,6 +67,8 @@
</span><span class="cx"> class RecordsWithEmailAddressCommand(amp.Command):
</span><span class="cx"> arguments = [
</span><span class="cx"> ('emailAddress', amp.String()),
</span><ins>+ ('limitResults', amp.Integer(optional=True)),
+ ('timeoutSeconds', amp.Integer(optional=True)),
</ins><span class="cx"> ]
</span><span class="cx"> response = [
</span><span class="cx"> ('items', amp.ListOf(amp.String())),
</span><span class="lines">@@ -85,6 +92,8 @@
</span><span class="cx"> arguments = [
</span><span class="cx"> ('tokens', amp.ListOf(amp.String())),
</span><span class="cx"> ('context', amp.String(optional=True)),
</span><ins>+ ('limitResults', amp.Integer(optional=True)),
+ ('timeoutSeconds', amp.Integer(optional=True)),
</ins><span class="cx"> ]
</span><span class="cx"> response = [
</span><span class="cx"> ('items', amp.ListOf(amp.String())),
</span><span class="lines">@@ -98,6 +107,8 @@
</span><span class="cx"> ('fields', amp.ListOf(amp.ListOf(amp.String()))),
</span><span class="cx"> ('operand', amp.String()),
</span><span class="cx"> ('recordType', amp.String(optional=True)),
</span><ins>+ ('limitResults', amp.Integer(optional=True)),
+ ('timeoutSeconds', amp.Integer(optional=True)),
</ins><span class="cx"> ]
</span><span class="cx"> response = [
</span><span class="cx"> ('items', amp.ListOf(amp.String())),
</span></span></pre></div>
<a id="CalendarServertrunktxdavdpsserverpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/dps/server.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/dps/server.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/txdav/dps/server.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -228,13 +228,14 @@
</span><span class="cx">
</span><span class="cx"> @RecordWithShortNameCommand.responder
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithShortName(self, recordType, shortName):
</del><ins>+ def recordWithShortName(self, recordType, shortName, timeoutSeconds=None):
</ins><span class="cx"> recordType = recordType # keep as bytes
</span><span class="cx"> shortName = shortName.decode("utf-8")
</span><span class="cx"> log.debug("RecordWithShortName: {r} {n}", r=recordType, n=shortName)
</span><span class="cx"> record = (yield self._directory.recordWithShortName(
</span><del>- self._directory.recordType.lookupByName(recordType), shortName)
- )
</del><ins>+ self._directory.recordType.lookupByName(recordType), shortName,
+ timeoutSeconds=timeoutSeconds
+ ))
</ins><span class="cx"> fields = self.recordToDict(record)
</span><span class="cx"> response = {
</span><span class="cx"> "fields": pickle.dumps(fields),
</span><span class="lines">@@ -245,11 +246,13 @@
</span><span class="cx">
</span><span class="cx"> @RecordWithUIDCommand.responder
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithUID(self, uid):
</del><ins>+ def recordWithUID(self, uid, timeoutSeconds=None):
</ins><span class="cx"> uid = uid.decode("utf-8")
</span><span class="cx"> log.debug("RecordWithUID: {u}", u=uid)
</span><span class="cx"> try:
</span><del>- record = (yield self._directory.recordWithUID(uid))
</del><ins>+ record = (yield self._directory.recordWithUID(
+ uid, timeoutSeconds=timeoutSeconds
+ ))
</ins><span class="cx"> except Exception as e:
</span><span class="cx"> log.error("Failed in recordWithUID", error=e)
</span><span class="cx"> record = None
</span><span class="lines">@@ -263,10 +266,12 @@
</span><span class="cx">
</span><span class="cx"> @RecordWithGUIDCommand.responder
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithGUID(self, guid):
</del><ins>+ def recordWithGUID(self, guid, timeoutSeconds=None):
</ins><span class="cx"> guid = uuid.UUID(guid)
</span><span class="cx"> log.debug("RecordWithGUID: {g}", g=guid)
</span><del>- record = (yield self._directory.recordWithGUID(guid))
</del><ins>+ record = (yield self._directory.recordWithGUID(
+ guid, timeoutSeconds=timeoutSeconds
+ ))
</ins><span class="cx"> fields = self.recordToDict(record)
</span><span class="cx"> response = {
</span><span class="cx"> "fields": pickle.dumps(fields),
</span><span class="lines">@@ -277,12 +282,15 @@
</span><span class="cx">
</span><span class="cx"> @RecordsWithRecordTypeCommand.responder
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsWithRecordType(self, recordType):
</del><ins>+ def recordsWithRecordType(
+ self, recordType, limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> recordType = recordType # as bytes
</span><span class="cx"> log.debug("RecordsWithRecordType: {r}", r=recordType)
</span><span class="cx"> records = (yield self._directory.recordsWithRecordType(
</span><del>- self._directory.recordType.lookupByName(recordType))
- )
</del><ins>+ self._directory.recordType.lookupByName(recordType),
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
+ ))
</ins><span class="cx"> response = self._recordsToResponse(records)
</span><span class="cx"> # log.debug("Responding with: {response}", response=response)
</span><span class="cx"> returnValue(response)
</span><span class="lines">@@ -290,10 +298,15 @@
</span><span class="cx">
</span><span class="cx"> @RecordsWithEmailAddressCommand.responder
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsWithEmailAddress(self, emailAddress):
</del><ins>+ def recordsWithEmailAddress(
+ self, emailAddress, limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> emailAddress = emailAddress.decode("utf-8")
</span><span class="cx"> log.debug("RecordsWithEmailAddress: {e}", e=emailAddress)
</span><del>- records = (yield self._directory.recordsWithEmailAddress(emailAddress))
</del><ins>+ records = (yield self._directory.recordsWithEmailAddress(
+ emailAddress,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
+ ))
</ins><span class="cx"> response = self._recordsToResponse(records)
</span><span class="cx"> # log.debug("Responding with: {response}", response=response)
</span><span class="cx"> returnValue(response)
</span><span class="lines">@@ -301,11 +314,14 @@
</span><span class="cx">
</span><span class="cx"> @RecordsMatchingTokensCommand.responder
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsMatchingTokens(self, tokens, context=None):
</del><ins>+ def recordsMatchingTokens(
+ self, tokens, context=None, limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> tokens = [t.decode("utf-8") for t in tokens]
</span><span class="cx"> log.debug("RecordsMatchingTokens: {t}", t=(", ".join(tokens)))
</span><span class="cx"> records = yield self._directory.recordsMatchingTokens(
</span><del>- tokens, context=context
</del><ins>+ tokens, context=context,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx"> response = self._recordsToResponse(records)
</span><span class="cx"> # log.debug("Responding with: {response}", response=response)
</span><span class="lines">@@ -314,7 +330,10 @@
</span><span class="cx">
</span><span class="cx"> @RecordsMatchingFieldsCommand.responder
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsMatchingFields(self, fields, operand="OR", recordType=None):
</del><ins>+ def recordsMatchingFields(
+ self, fields, operand="OR", recordType=None,
+ limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> log.debug("RecordsMatchingFields")
</span><span class="cx"> newFields = []
</span><span class="cx"> for fieldName, searchTerm, matchFlags, matchType in fields:
</span><span class="lines">@@ -345,7 +364,8 @@
</span><span class="cx"> if recordType:
</span><span class="cx"> recordType = self._directory.recordType.lookupByName(recordType)
</span><span class="cx"> records = yield self._directory.recordsMatchingFields(
</span><del>- newFields, operand=operand, recordType=recordType
</del><ins>+ newFields, operand=operand, recordType=recordType,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx"> response = self._recordsToResponse(records)
</span><span class="cx"> # log.debug("Responding with: {response}", response=response)
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhoaugmentpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/augment.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/augment.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/txdav/who/augment.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -151,9 +151,13 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsFromExpression(self, expression, recordTypes=None):
</del><ins>+ def recordsFromExpression(
+ self, expression, recordTypes=None,
+ limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> records = yield self._directory.recordsFromExpression(
</span><del>- expression, recordTypes=recordTypes
</del><ins>+ expression, recordTypes=recordTypes,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx"> augmented = []
</span><span class="cx"> for record in records:
</span><span class="lines">@@ -163,9 +167,12 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsWithFieldValue(self, fieldName, value):
</del><ins>+ def recordsWithFieldValue(
+ self, fieldName, value, limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> records = yield self._directory.recordsWithFieldValue(
</span><del>- fieldName, value
</del><ins>+ fieldName, value,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx"> augmented = []
</span><span class="cx"> for record in records:
</span><span class="lines">@@ -176,29 +183,37 @@
</span><span class="cx">
</span><span class="cx"> @timed
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithUID(self, uid):
</del><ins>+ def recordWithUID(self, uid, timeoutSeconds=None):
</ins><span class="cx"> # MOVE2WHO, REMOVE THIS:
</span><span class="cx"> if not isinstance(uid, unicode):
</span><span class="cx"> # log.warn("Need to change uid to unicode")
</span><span class="cx"> uid = uid.decode("utf-8")
</span><span class="cx">
</span><del>- record = yield self._directory.recordWithUID(uid)
</del><ins>+ record = yield self._directory.recordWithUID(
+ uid, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> record = yield self._augment(record)
</span><span class="cx"> returnValue(record)
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @timed
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithGUID(self, guid):
- record = yield self._directory.recordWithGUID(guid)
</del><ins>+ def recordWithGUID(self, guid, timeoutSeconds=None):
+ record = yield self._directory.recordWithGUID(
+ guid, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> record = yield self._augment(record)
</span><span class="cx"> returnValue(record)
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @timed
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsWithRecordType(self, recordType):
- records = yield self._directory.recordsWithRecordType(recordType)
</del><ins>+ def recordsWithRecordType(
+ self, recordType, limitResults=None, timeoutSeconds=None
+ ):
+ records = yield self._directory.recordsWithRecordType(
+ recordType, limitResults=limitResults, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> augmented = []
</span><span class="cx"> for record in records:
</span><span class="cx"> record = yield self._augment(record)
</span><span class="lines">@@ -208,14 +223,14 @@
</span><span class="cx">
</span><span class="cx"> @timed
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithShortName(self, recordType, shortName):
</del><ins>+ def recordWithShortName(self, recordType, shortName, timeoutSeconds=None):
</ins><span class="cx"> # MOVE2WHO, REMOVE THIS:
</span><span class="cx"> if not isinstance(shortName, unicode):
</span><span class="cx"> # log.warn("Need to change shortName to unicode")
</span><span class="cx"> shortName = shortName.decode("utf-8")
</span><span class="cx">
</span><span class="cx"> record = yield self._directory.recordWithShortName(
</span><del>- recordType, shortName
</del><ins>+ recordType, shortName, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx"> record = yield self._augment(record)
</span><span class="cx"> returnValue(record)
</span><span class="lines">@@ -223,13 +238,18 @@
</span><span class="cx">
</span><span class="cx"> @timed
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsWithEmailAddress(self, emailAddress):
</del><ins>+ def recordsWithEmailAddress(
+ self, emailAddress, limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> # MOVE2WHO, REMOVE THIS:
</span><span class="cx"> if not isinstance(emailAddress, unicode):
</span><span class="cx"> # log.warn("Need to change emailAddress to unicode")
</span><span class="cx"> emailAddress = emailAddress.decode("utf-8")
</span><span class="cx">
</span><del>- records = yield self._directory.recordsWithEmailAddress(emailAddress)
</del><ins>+ records = yield self._directory.recordsWithEmailAddress(
+ emailAddress,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> augmented = []
</span><span class="cx"> for record in records:
</span><span class="cx"> record = yield self._augment(record)
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhocachepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/cache.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/cache.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/txdav/who/cache.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -232,12 +232,14 @@
</span><span class="cx"> # Cached methods:
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithUID(self, uid):
</del><ins>+ def recordWithUID(self, uid, timeoutSeconds=None):
</ins><span class="cx">
</span><span class="cx"> # First check our cache
</span><span class="cx"> record = self.lookupRecord(IndexType.uid, uid, "recordWithUID")
</span><span class="cx"> if record is None:
</span><del>- record = yield self._directory.recordWithUID(uid)
</del><ins>+ record = yield self._directory.recordWithUID(
+ uid, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> if record is not None:
</span><span class="cx"> # Note we do not index on email address; see below.
</span><span class="cx"> self.cacheRecord(
</span><span class="lines">@@ -249,12 +251,14 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithGUID(self, guid):
</del><ins>+ def recordWithGUID(self, guid, timeoutSeconds=None):
</ins><span class="cx">
</span><span class="cx"> # First check our cache
</span><span class="cx"> record = self.lookupRecord(IndexType.guid, guid, "recordWithGUID")
</span><span class="cx"> if record is None:
</span><del>- record = yield self._directory.recordWithGUID(guid)
</del><ins>+ record = yield self._directory.recordWithGUID(
+ guid, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> if record is not None:
</span><span class="cx"> # Note we do not index on email address; see below.
</span><span class="cx"> self.cacheRecord(
</span><span class="lines">@@ -266,7 +270,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithShortName(self, recordType, shortName):
</del><ins>+ def recordWithShortName(self, recordType, shortName, timeoutSeconds=None):
</ins><span class="cx">
</span><span class="cx"> # First check our cache
</span><span class="cx"> record = self.lookupRecord(
</span><span class="lines">@@ -276,7 +280,7 @@
</span><span class="cx"> )
</span><span class="cx"> if record is None:
</span><span class="cx"> record = yield self._directory.recordWithShortName(
</span><del>- recordType, shortName
</del><ins>+ recordType, shortName, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx"> if record is not None:
</span><span class="cx"> # Note we do not index on email address; see below.
</span><span class="lines">@@ -289,7 +293,9 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsWithEmailAddress(self, emailAddress):
</del><ins>+ def recordsWithEmailAddress(
+ self, emailAddress, limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx">
</span><span class="cx"> # First check our cache
</span><span class="cx"> record = self.lookupRecord(
</span><span class="lines">@@ -298,7 +304,10 @@
</span><span class="cx"> "recordsWithEmailAddress"
</span><span class="cx"> )
</span><span class="cx"> if record is None:
</span><del>- records = yield self._directory.recordsWithEmailAddress(emailAddress)
</del><ins>+ records = yield self._directory.recordsWithEmailAddress(
+ emailAddress,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> if len(records) == 1:
</span><span class="cx"> # Only cache if there was a single match (which is the most
</span><span class="cx"> # common scenario). Caching multiple records for the exact
</span><span class="lines">@@ -335,17 +344,25 @@
</span><span class="cx"> return self._directory.recordTypes()
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordsFromExpression(self, expression, recordTypes=None):
</del><ins>+ def recordsFromExpression(
+ self, expression, recordTypes=None,
+ limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> # Defer to the directory service we're caching
</span><span class="cx"> return self._directory.recordsFromExpression(
</span><del>- expression, recordTypes=recordTypes
</del><ins>+ expression, recordTypes=recordTypes,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordsWithFieldValue(self, fieldName, value):
</del><ins>+ def recordsWithFieldValue(
+ self, fieldName, value,
+ limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> # Defer to the directory service we're caching
</span><span class="cx"> return self._directory.recordsWithFieldValue(
</span><del>- fieldName, value
</del><ins>+ fieldName, value,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -359,22 +376,31 @@
</span><span class="cx"> return self._directory.removeRecords(uids)
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordsWithRecordType(self, recordType):
</del><ins>+ def recordsWithRecordType(
+ self, recordType, limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> # Defer to the directory service we're caching
</span><del>- return self._directory.recordsWithRecordType(recordType)
</del><ins>+ return self._directory.recordsWithRecordType(
+ recordType, limitResults=limitResults, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx">
</span><span class="cx">
</span><del>- def recordsMatchingTokens(self, tokens, context=None, limitResults=50,
- timeoutSeconds=10):
</del><ins>+ def recordsMatchingTokens(
+ self, tokens, context=None, limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> return self._directory.recordsMatchingTokens(
</span><del>- tokens, context=context, limitResults=limitResults,
- timeoutSeconds=timeoutSeconds
</del><ins>+ tokens, context=context,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordsMatchingFields(self, fields, operand, recordType):
</del><ins>+ def recordsMatchingFields(
+ self, fields, operand, recordType,
+ limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> return self._directory.recordsMatchingFields(
</span><del>- fields, operand, recordType
</del><ins>+ fields, operand, recordType,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -382,10 +408,10 @@
</span><span class="cx"> return self._directory.recordsWithDirectoryBasedDelegates()
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordWithCalendarUserAddress(self, cua):
</del><ins>+ def recordWithCalendarUserAddress(self, cua, timeoutSeconds=None):
</ins><span class="cx"> # This will get cached by the underlying recordWith... call
</span><span class="cx"> return CalendarDirectoryServiceMixin.recordWithCalendarUserAddress(
</span><del>- self, cua
</del><ins>+ self, cua, timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhodelegatespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/delegates.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/delegates.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/txdav/who/delegates.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx"> parentUID, _ignore_proxyType = self.uid.split(u"#")
</span><span class="cx"> readWrite = (self.recordType is RecordType.writeDelegateGroup)
</span><span class="cx">
</span><del>- log.debug(
</del><ins>+ log.info(
</ins><span class="cx"> "Setting delegate assignments for {u} ({rw}) to {m}",
</span><span class="cx"> u=parentUID, rw=("write" if readWrite else "read"),
</span><span class="cx"> m=[r.uid for r in memberRecords]
</span><span class="lines">@@ -177,7 +177,7 @@
</span><span class="cx"> self._masterDirectory = masterDirectory
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordWithShortName(self, recordType, shortName):
</del><ins>+ def recordWithShortName(self, recordType, shortName, timeoutSeconds=None):
</ins><span class="cx"> uid = shortName + "#" + recordTypeToProxyType(recordType)
</span><span class="cx">
</span><span class="cx"> record = DirectoryRecord(self, {
</span><span class="lines">@@ -188,18 +188,23 @@
</span><span class="cx"> return succeed(record)
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordWithUID(self, uid):
</del><ins>+ def recordWithUID(self, uid, timeoutSeconds=None):
</ins><span class="cx"> if "#" not in uid: # Not a delegate group uid
</span><span class="cx"> return succeed(None)
</span><span class="cx"> uid, proxyType = uid.split("#")
</span><span class="cx"> recordType = proxyTypeToRecordType(proxyType)
</span><span class="cx"> if recordType is None:
</span><span class="cx"> return succeed(None)
</span><del>- return self.recordWithShortName(recordType, uid)
</del><ins>+ return self.recordWithShortName(
+ recordType, uid, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsFromExpression(self, expression, recordTypes=None, records=None):
</del><ins>+ def recordsFromExpression(
+ self, expression, recordTypes=None, records=None,
+ limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> """
</span><span class="cx"> It's only ever appropriate to look up delegate group record by
</span><span class="cx"> shortName or uid. When wrapped by an aggregate directory, looking up
</span><span class="lines">@@ -213,7 +218,9 @@
</span><span class="cx"> (expression.matchType is MatchType.equals) and
</span><span class="cx"> ("#" in expression.fieldValue)
</span><span class="cx"> ):
</span><del>- record = yield self.recordWithUID(expression.fieldValue)
</del><ins>+ record = yield self.recordWithUID(
+ expression.fieldValue, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> if record is not None:
</span><span class="cx"> returnValue((record,))
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhodirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/directory.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/directory.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/txdav/who/directory.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -71,13 +71,17 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithCalendarUserAddress(self, address):
</del><ins>+ def recordWithCalendarUserAddress(
+ self, address, timeoutSeconds=None
+ ):
</ins><span class="cx"> address = normalizeCUAddr(address)
</span><span class="cx"> record = None
</span><span class="cx">
</span><span class="cx"> if address.startswith("urn:x-uid:"):
</span><span class="cx"> uid = address[10:]
</span><del>- record = yield self.recordWithUID(uid)
</del><ins>+ record = yield self.recordWithUID(
+ uid, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx">
</span><span class="cx"> elif address.startswith("urn:uuid:"):
</span><span class="cx"> try:
</span><span class="lines">@@ -85,10 +89,14 @@
</span><span class="cx"> except ValueError:
</span><span class="cx"> log.info("Invalid GUID: {guid}", guid=address[9:])
</span><span class="cx"> returnValue(None)
</span><del>- record = yield self.recordWithGUID(guid)
</del><ins>+ record = yield self.recordWithGUID(
+ guid, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx">
</span><span class="cx"> elif address.startswith("mailto:"):
</span><del>- records = yield self.recordsWithEmailAddress(address[7:])
</del><ins>+ records = yield self.recordsWithEmailAddress(
+ address[7:], limitResults=1, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> record = records[0] if records else None
</span><span class="cx">
</span><span class="cx"> elif address.startswith("/principals/"):
</span><span class="lines">@@ -96,10 +104,14 @@
</span><span class="cx"> if len(parts) == 4:
</span><span class="cx"> if parts[2] == "__uids__":
</span><span class="cx"> uid = parts[3]
</span><del>- record = yield self.recordWithUID(uid)
</del><ins>+ record = yield self.recordWithUID(
+ uid, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx"> else:
</span><span class="cx"> recordType = self.oldNameToRecordType(parts[2])
</span><del>- record = yield self.recordWithShortName(recordType, parts[3])
</del><ins>+ record = yield self.recordWithShortName(
+ recordType, parts[3], timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx">
</span><span class="cx"> if record:
</span><span class="cx"> if record.hasCalendars or (
</span><span class="lines">@@ -146,8 +158,8 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordsMatchingTokens(self, tokens, context=None, limitResults=50,
- timeoutSeconds=10):
</del><ins>+ def recordsMatchingTokens(self, tokens, context=None, limitResults=None,
+ timeoutSeconds=None):
</ins><span class="cx"> fields = [
</span><span class="cx"> ("fullNames", MatchType.contains),
</span><span class="cx"> ("emailAddresses", MatchType.startsWith),
</span><span class="lines">@@ -183,7 +195,8 @@
</span><span class="cx"> recordTypes = None
</span><span class="cx">
</span><span class="cx"> results = yield self.recordsFromExpression(
</span><del>- expression, recordTypes=recordTypes
</del><ins>+ expression, recordTypes=recordTypes, limitResults=limitResults,
+ timeoutSeconds=timeoutSeconds
</ins><span class="cx"> )
</span><span class="cx"> log.debug(
</span><span class="cx"> "Tokens ({t}) matched {n} records",
</span><span class="lines">@@ -193,7 +206,10 @@
</span><span class="cx"> returnValue(results)
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordsMatchingFields(self, fields, operand=Operand.OR, recordType=None):
</del><ins>+ def recordsMatchingFields(
+ self, fields, operand=Operand.OR, recordType=None,
+ limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> """
</span><span class="cx"> @param fields: a iterable of tuples, each tuple consisting of:
</span><span class="cx"> directory field name (C{unicode})
</span><span class="lines">@@ -228,7 +244,10 @@
</span><span class="cx"> recordTypes = [recordType]
</span><span class="cx"> else:
</span><span class="cx"> recordTypes = None
</span><del>- return self.recordsFromExpression(expression, recordTypes=recordTypes)
</del><ins>+ return self.recordsFromExpression(
+ expression, recordTypes=recordTypes,
+ limitResults=limitResults, timeoutSeconds=timeoutSeconds
+ )
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> _oldRecordTypeNames = {
</span><span class="lines">@@ -282,11 +301,7 @@
</span><span class="cx">
</span><span class="cx"> records = yield self.recordsFromExpression(
</span><span class="cx"> expression,
</span><del>- recordTypes=(self.recordType.location,)
- # FIXME, commenting out resources for the moment since it's
- # super slow:
- # recordTypes=(self.recordType.location, self.recordType.resource)
-
</del><ins>+ recordTypes=(self.recordType.location, self.recordType.resource)
</ins><span class="cx"> )
</span><span class="cx"> returnValue(records)
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhotesttest_group_attendeespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/test/test_group_attendees.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/test/test_group_attendees.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/txdav/who/test/test_group_attendees.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -1459,7 +1459,7 @@
</span><span class="cx"> unpatchedRecordWithUID = DirectoryService.recordWithUID
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def recordWithUID(self, uid):
</del><ins>+ def recordWithUID(self, uid, timeoutSeconds=None):
</ins><span class="cx">
</span><span class="cx"> if uid == "group02":
</span><span class="cx"> result = None
</span></span></pre></div>
<a id="CalendarServertrunktxdavwhowikipy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/who/wiki.py (13948 => 13949)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/who/wiki.py        2014-09-11 03:32:22 UTC (rev 13948)
+++ CalendarServer/trunk/txdav/who/wiki.py        2014-09-11 03:34:30 UTC (rev 13949)
</span><span class="lines">@@ -121,19 +121,22 @@
</span><span class="cx"> return succeed(None)
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordWithUID(self, uid):
</del><ins>+ def recordWithUID(self, uid, timeoutSeconds=None):
</ins><span class="cx"> if uid.startswith(self.uidPrefix):
</span><span class="cx"> return self._recordWithName(uid[len(self.uidPrefix):])
</span><span class="cx"> return succeed(None)
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordWithShortName(self, recordType, shortName):
</del><ins>+ def recordWithShortName(self, recordType, shortName, timeoutSeconds=None):
</ins><span class="cx"> if recordType is RecordType.macOSXServerWiki:
</span><span class="cx"> return self._recordWithName(shortName)
</span><span class="cx"> return succeed(None)
</span><span class="cx">
</span><span class="cx">
</span><del>- def recordsFromExpression(self, expression, recordTypes=None, records=None):
</del><ins>+ def recordsFromExpression(
+ self, expression, recordTypes=None, records=None,
+ limitResults=None, timeoutSeconds=None
+ ):
</ins><span class="cx"> return succeed(())
</span><span class="cx">
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>