[CalendarServer-changes] [13067] twext/trunk/twext/who
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 31 15:12:49 PDT 2014
Revision: 13067
http://trac.calendarserver.org//changeset/13067
Author: wsanchez at apple.com
Date: 2014-03-31 15:12:49 -0700 (Mon, 31 Mar 2014)
Log Message:
-----------
For OD, recordWithShortName takes the first result and doesn't barf on others.
Modified Paths:
--------------
twext/trunk/twext/who/opendirectory/_service.py
twext/trunk/twext/who/util.py
Modified: twext/trunk/twext/who/opendirectory/_service.py
===================================================================
--- twext/trunk/twext/who/opendirectory/_service.py 2014-03-31 22:02:34 UTC (rev 13066)
+++ twext/trunk/twext/who/opendirectory/_service.py 2014-03-31 22:12:49 UTC (rev 13067)
@@ -44,7 +44,7 @@
MatchExpression, MatchFlags,
)
from ..ldap._util import LDAP_QUOTING_TABLE
-from ..util import ConstantsContainer, uniqueResult
+from ..util import ConstantsContainer, firstResult
from ._odframework import ODSession, ODNode, ODQuery
from ._constants import (
@@ -549,7 +549,7 @@
results = yield self._recordsFromQuery(query)
try:
- record = uniqueResult(results)
+ record = firstResult(results)
except DirectoryServiceError:
self.log.error(
"Duplicate records for name: {name} ({recordType})"
Modified: twext/trunk/twext/who/util.py
===================================================================
--- twext/trunk/twext/who/util.py 2014-03-31 22:02:34 UTC (rev 13066)
+++ twext/trunk/twext/who/util.py 2014-03-31 22:12:49 UTC (rev 13067)
@@ -146,6 +146,13 @@
+def firstResult(values):
+ for value in values:
+ return value
+ return None
+
+
+
def describe(constant):
if isinstance(constant, FlagConstant):
return "|".join(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140331/08dbec04/attachment.html>
More information about the calendarserver-changes
mailing list