<!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>[14508] CalendarServer/trunk/txdav/common/datastore/test</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/14508">14508</a></dd>
<dt>Author</dt> <dd>wsanchez@apple.com</dd>
<dt>Date</dt> <dd>2015-03-05 10:27:14 -0800 (Thu, 05 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove trivial uses of inlineCallbacks.
Lint.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktxdavcommondatastoretesttest_sqlpy">CalendarServer/trunk/txdav/common/datastore/test/test_sql.py</a></li>
<li><a href="#CalendarServertrunktxdavcommondatastoretestutilpy">CalendarServer/trunk/txdav/common/datastore/test/util.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktxdavcommondatastoretesttest_sqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/test/test_sql.py (14507 => 14508)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/test/test_sql.py        2015-03-05 02:41:22 UTC (rev 14507)
+++ CalendarServer/trunk/txdav/common/datastore/test/test_sql.py        2015-03-05 18:27:14 UTC (rev 14508)
</span><span class="lines">@@ -71,9 +71,9 @@
</span><span class="cx"> txn = self.transactionUnderTest()
</span><span class="cx"> cs = schema.CALENDARSERVER
</span><span class="cx"> version = (yield Select(
</span><del>- [cs.VALUE, ],
</del><ins>+ [cs.VALUE],
</ins><span class="cx"> From=cs,
</span><del>- Where=cs.NAME == 'VERSION',
</del><ins>+ Where=cs.NAME == "VERSION",
</ins><span class="cx"> ).on(txn))
</span><span class="cx"> self.assertNotEqual(version, None)
</span><span class="cx"> self.assertEqual(len(version), 1)
</span></span></pre></div>
<a id="CalendarServertrunktxdavcommondatastoretestutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/common/datastore/test/util.py (14507 => 14508)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/common/datastore/test/util.py        2015-03-05 02:41:22 UTC (rev 14507)
+++ CalendarServer/trunk/txdav/common/datastore/test/util.py        2015-03-05 18:27:14 UTC (rev 14508)
</span><span class="lines">@@ -108,10 +108,13 @@
</span><span class="cx"> def __init__(self, count=0):
</span><span class="cx"> self.sharedService = None
</span><span class="cx"> self.currentTestID = None
</span><del>- self.sharedDBPath = "_test_sql_db" + str(os.getpid()) + ("-{}".format(count) if count else "")
</del><span class="cx"> self.ampPort = config.WorkQueue.ampPort + count
</span><span class="cx">
</span><ins>+ self.sharedDBPath = "_test_sql_db-{}-{}".format(
+ os.getpid(), count
+ )
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> def createService(self, serviceFactory):
</span><span class="cx"> """
</span><span class="cx"> Create a L{PostgresService} to use for building a store.
</span><span class="lines">@@ -157,7 +160,10 @@
</span><span class="cx"> return cds
</span><span class="cx">
</span><span class="cx">
</span><del>- def buildStore(self, testCase, notifierFactory, directoryService=None, homes=None, enableJobProcessing=True):
</del><ins>+ def buildStore(
+ self, testCase, notifierFactory,
+ directoryService=None, homes=None, enableJobProcessing=True,
+ ):
</ins><span class="cx"> """
</span><span class="cx"> Do the necessary work to build a store for a particular test case.
</span><span class="cx">
</span><span class="lines">@@ -169,34 +175,45 @@
</span><span class="cx"> # The directory will be given to us later via setDirectoryService
</span><span class="cx"> if self.sharedService is None:
</span><span class="cx"> ready = Deferred()
</span><ins>+
</ins><span class="cx"> def getReady(connectionFactory, storageService):
</span><span class="cx"> self.makeAndCleanStore(
</span><del>- testCase, notifierFactory, directoryService, attachmentRoot, enableJobProcessing
</del><ins>+ testCase, notifierFactory, directoryService,
+ attachmentRoot, enableJobProcessing
</ins><span class="cx"> ).chainDeferred(ready)
</span><span class="cx"> return Service()
</span><ins>+
</ins><span class="cx"> self.sharedService = self.createService(getReady)
</span><span class="cx"> self.sharedService.startService()
</span><ins>+
</ins><span class="cx"> def startStopping():
</span><span class="cx"> log.info("Starting stopping.")
</span><span class="cx"> self.sharedService.unpauseMonitor()
</span><span class="cx"> return self.sharedService.stopService()
</span><del>- reactor.addSystemEventTrigger(#@UndefinedVariable
</del><ins>+
+ reactor.addSystemEventTrigger(
</ins><span class="cx"> "before", "shutdown", startStopping)
</span><span class="cx"> result = ready
</span><span class="cx"> else:
</span><span class="cx"> result = self.makeAndCleanStore(
</span><del>- testCase, notifierFactory, directoryService, attachmentRoot, enableJobProcessing
</del><ins>+ testCase, notifierFactory, directoryService,
+ attachmentRoot, enableJobProcessing
</ins><span class="cx"> )
</span><ins>+
</ins><span class="cx"> def cleanUp():
</span><span class="cx"> def stopit():
</span><span class="cx"> self.sharedService.pauseMonitor()
</span><span class="cx"> return deferLater(reactor, 0.1, stopit)
</span><ins>+
</ins><span class="cx"> testCase.addCleanup(cleanUp)
</span><span class="cx"> return result
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def makeAndCleanStore(self, testCase, notifierFactory, directoryService, attachmentRoot, enableJobProcessing=True):
</del><ins>+ def makeAndCleanStore(
+ self, testCase, notifierFactory, directoryService,
+ attachmentRoot, enableJobProcessing=True
+ ):
</ins><span class="cx"> """
</span><span class="cx"> Create a L{CommonDataStore} specific to the given L{TestCase}.
</span><span class="cx">
</span><span class="lines">@@ -213,14 +230,19 @@
</span><span class="cx"> attachmentRoot.createDirectory()
</span><span class="cx">
</span><span class="cx"> currentTestID = testCase.id()
</span><del>- cp = ConnectionPool(self.sharedService.produceConnection, maxConnections=4)
</del><ins>+ cp = ConnectionPool(
+ self.sharedService.produceConnection, maxConnections=4
+ )
</ins><span class="cx"> quota = deriveQuota(testCase)
</span><span class="cx"> store = CommonDataStore(
</span><span class="cx"> cp.connection,
</span><span class="cx"> {"push": notifierFactory} if notifierFactory is not None else {},
</span><span class="cx"> directoryService,
</span><span class="cx"> attachmentRoot,
</span><del>- "https://example.com/calendars/__uids__/%(home)s/attachments/%(name)s",
</del><ins>+ (
+ "https://example.com/calendars/__uids__/"
+ "%(home)s/attachments/%(name)s"
+ ),
</ins><span class="cx"> quota=quota
</span><span class="cx"> )
</span><span class="cx"> store.label = currentTestID
</span><span class="lines">@@ -279,11 +301,13 @@
</span><span class="cx"> # table' statements are issued, so it's not possible to reference a
</span><span class="cx"> # later table. Therefore it's OK to drop them in the (reverse) order
</span><span class="cx"> # that they happen to be in.
</span><del>- tables = [t.name for t in schema.model.tables #@UndefinedVariable
- # All tables with rows _in_ the schema are populated
- # exclusively _by_ the schema and shouldn't be manipulated
- # while the server is running, so we leave those populated.
- if not t.schemaRows][::-1]
</del><ins>+ tables = [
+ t.name for t in schema.model.tables
+ # All tables with rows _in_ the schema are populated
+ # exclusively _by_ the schema and shouldn't be manipulated
+ # while the server is running, so we leave those populated.
+ if not t.schemaRows
+ ][::-1]
</ins><span class="cx">
</span><span class="cx"> for table in tables:
</span><span class="cx"> try:
</span><span class="lines">@@ -446,24 +470,32 @@
</span><span class="cx"> try:
</span><span class="cx"> if config.RestrictCalendarsToOneComponentType:
</span><span class="cx"> for name in ical.allowedStoreComponents:
</span><del>- yield home.removeCalendarWithName(home._componentCalendarName[name])
</del><ins>+ yield home.removeCalendarWithName(
+ home._componentCalendarName[name]
+ )
</ins><span class="cx"> else:
</span><span class="cx"> yield home.removeCalendarWithName("calendar")
</span><span class="cx"> yield home.removeCalendarWithName("inbox")
</span><span class="cx"> except NoSuchHomeChildError:
</span><span class="cx"> pass
</span><ins>+
</ins><span class="cx"> for calendarName in calendars:
</span><span class="cx"> calendarObjNames = calendars[calendarName]
</span><ins>+
</ins><span class="cx"> if calendarObjNames is not None:
</span><span class="cx"> # XXX should not be yielding! this SQL will be executed
</span><span class="cx"> # first!
</span><span class="cx"> yield home.createCalendarWithName(calendarName)
</span><span class="cx"> calendar = yield home.calendarWithName(calendarName)
</span><ins>+
</ins><span class="cx"> for objectName in calendarObjNames:
</span><span class="cx"> objData, metadata = calendarObjNames[objectName]
</span><ins>+
</ins><span class="cx"> yield calendar._createCalendarObjectWithNameInternal(
</span><span class="cx"> objectName,
</span><del>- VComponent.fromString(updateToCurrentYear(objData)),
</del><ins>+ VComponent.fromString(
+ updateToCurrentYear(objData)
+ ),
</ins><span class="cx"> internal_state=ComponentUpdateState.RAW,
</span><span class="cx"> options=metadata,
</span><span class="cx"> )
</span><span class="lines">@@ -474,7 +506,8 @@
</span><span class="cx">
</span><span class="cx"> def updateToCurrentYear(data):
</span><span class="cx"> """
</span><del>- Update the supplied iCalendar data so that all dates are updated to the current year.
</del><ins>+ Update the supplied iCalendar data so that all dates are updated to the
+ current year.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> nowYear = DateTime.getToday().getYear()
</span><span class="lines">@@ -486,7 +519,8 @@
</span><span class="cx">
</span><span class="cx"> def componentUpdate(data):
</span><span class="cx"> """
</span><del>- Update the supplied iCalendar data so that all dates are updated to the current year.
</del><ins>+ Update the supplied iCalendar data so that all dates are updated to the
+ current year.
</ins><span class="cx"> """
</span><span class="cx">
</span><span class="cx"> if len(relativeDateSubstitutions) == 0:
</span><span class="lines">@@ -533,10 +567,12 @@
</span><span class="cx"> calendar = yield home.calendarWithName(calendarName)
</span><span class="cx"> for objectName in calendarObjNames:
</span><span class="cx"> md5 = calendarObjNames[objectName]
</span><del>- obj = yield calendar.calendarObjectWithName(
- objectName,
</del><ins>+ obj = (
+ yield calendar.calendarObjectWithName(objectName)
+ ),
+ obj.properties()[md5key] = (
+ TwistedGETContentMD5.fromString(md5)
</ins><span class="cx"> )
</span><del>- obj.properties()[md5key] = TwistedGETContentMD5.fromString(md5)
</del><span class="cx"> yield populateTxn.commit()
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -567,7 +603,9 @@
</span><span class="cx"> # XXX should not be yielding! this SQL will be executed
</span><span class="cx"> # first!
</span><span class="cx"> yield home.createAddressBookWithName(addressbookName)
</span><del>- addressbook = yield home.addressbookWithName(addressbookName)
</del><ins>+ addressbook = (
+ yield home.addressbookWithName(addressbookName)
+ )
</ins><span class="cx"> for objectName in addressbookObjNames:
</span><span class="cx"> objData = addressbookObjNames[objectName]
</span><span class="cx"> yield addressbook.createAddressBookObjectWithName(
</span><span class="lines">@@ -598,13 +636,17 @@
</span><span class="cx"> if addressbookObjNames is not None:
</span><span class="cx"> # XXX should not be yielding! this SQL will be executed
</span><span class="cx"> # first!
</span><del>- addressbook = yield home.addressbookWithName(addressbookName)
</del><ins>+ addressbook = (
+ yield home.addressbookWithName(addressbookName)
+ )
</ins><span class="cx"> for objectName in addressbookObjNames:
</span><span class="cx"> md5 = addressbookObjNames[objectName]
</span><span class="cx"> obj = yield addressbook.addressbookObjectWithName(
</span><span class="cx"> objectName,
</span><span class="cx"> )
</span><del>- obj.properties()[md5key] = TwistedGETContentMD5.fromString(md5)
</del><ins>+ obj.properties()[md5key] = (
+ TwistedGETContentMD5.fromString(md5)
+ )
</ins><span class="cx"> yield populateTxn.commit()
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -627,8 +669,8 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def buildTestDirectory(
</span><del>- store, dataRoot, accounts=None, resources=None, augments=None, proxies=None,
- serversDB=None, cacheSeconds=0
</del><ins>+ store, dataRoot, accounts=None, resources=None, augments=None,
+ proxies=None, serversDB=None, cacheSeconds=0,
</ins><span class="cx"> ):
</span><span class="cx"> """
</span><span class="cx"> @param store: the store for the directory to use
</span><span class="lines">@@ -738,7 +780,8 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def buildStoreAndDirectory(
</span><span class="cx"> self, accounts=None, resources=None, augments=None, proxies=None,
</span><del>- extraUids=None, serversDB=None, cacheSeconds=0, storeBuilder=theStoreBuilder
</del><ins>+ extraUids=None, serversDB=None, cacheSeconds=0,
+ storeBuilder=theStoreBuilder,
</ins><span class="cx"> ):
</span><span class="cx">
</span><span class="cx"> self.serverRoot = self.mktemp()
</span><span class="lines">@@ -791,10 +834,12 @@
</span><span class="cx"> if not os.path.exists(config.LogRoot):
</span><span class="cx"> os.makedirs(config.LogRoot)
</span><span class="cx">
</span><del>- # Work queues for implicit scheduling slow down tests a lot and require them all to add
- # "waits" for work to complete. Rewriting all the current tests to do that is not practical
- # right now, so we will turn this off by default. Instead we will have a set of tests dedicated
- # to work queue-based scheduling which will patch this option to True.
</del><ins>+ # Work queues for implicit scheduling slow down tests a lot and require
+ # them all to add "waits" for work to complete.
+ # Rewriting all the current tests to do that is not practical right
+ # now, so we will turn this off by default.
+ # Instead we will have a set of tests dedicated to work queue-based
+ # scheduling which will patch this option to True.
</ins><span class="cx"> config.Scheduling.Options.WorkQueues.Enabled = False
</span><span class="cx">
</span><span class="cx"> self.config = config
</span><span class="lines">@@ -828,20 +873,25 @@
</span><span class="cx"> """
</span><span class="cx"> if self.savedStore is None:
</span><span class="cx"> self.savedStore = self.storeUnderTest()
</span><ins>+
</ins><span class="cx"> self.counter += 1
</span><ins>+
</ins><span class="cx"> if txn is None:
</span><span class="cx"> txn = self.savedStore.newTransaction(
</span><span class="cx"> self.id() + " #" + str(self.counter)
</span><span class="cx"> )
</span><span class="cx"> else:
</span><span class="cx"> txn._label = self.id() + " #" + str(self.counter)
</span><ins>+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def maybeCommitThis():
</span><span class="cx"> try:
</span><span class="cx"> yield txn.commit()
</span><span class="cx"> except AlreadyFinishedError:
</span><span class="cx"> pass
</span><ins>+
</ins><span class="cx"> self.addCleanup(maybeCommitThis)
</span><ins>+
</ins><span class="cx"> return txn
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -872,14 +922,13 @@
</span><span class="cx"> return self.store
</span><span class="cx">
</span><span class="cx">
</span><del>- @inlineCallbacks
</del><span class="cx"> def homeUnderTest(self, txn=None, name="home1", create=False):
</span><span class="cx"> """
</span><span class="cx"> Get the calendar home detailed by C{requirements['home1']}.
</span><span class="cx"> """
</span><span class="cx"> if txn is None:
</span><span class="cx"> txn = self.transactionUnderTest()
</span><del>- returnValue((yield txn.calendarHomeWithUID(name, create=create)))
</del><ins>+ return txn.calendarHomeWithUID(name, create=create)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="lines">@@ -887,19 +936,24 @@
</span><span class="cx"> """
</span><span class="cx"> Get the calendar detailed by C{requirements['home1']['calendar_1']}.
</span><span class="cx"> """
</span><del>- returnValue((
- yield (yield self.homeUnderTest(txn, home)).calendarWithName(name)
- ))
</del><ins>+ home = yield self.homeUnderTest(txn, home)
+ calendar = yield home.calendarWithName(name)
+ returnValue(calendar)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def calendarObjectUnderTest(self, txn=None, name="1.ics", calendar_name="calendar_1", home="home1"):
</del><ins>+ def calendarObjectUnderTest(
+ self, txn=None, name="1.ics", calendar_name="calendar_1", home="home1"
+ ):
</ins><span class="cx"> """
</span><span class="cx"> Get the calendar detailed by
</span><span class="cx"> C{requirements[home][calendar_name][name]}.
</span><span class="cx"> """
</span><del>- returnValue((yield (yield self.calendarUnderTest(txn, name=calendar_name, home=home))
- .calendarObjectWithName(name)))
</del><ins>+ calendar = yield self.calendarUnderTest(
+ txn, name=calendar_name, home=home
+ )
+ object = yield calendar.calendarObjectWithName(name)
+ returnValue(object)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def addressbookHomeUnderTest(self, txn=None, name="home1"):
</span><span class="lines">@@ -914,52 +968,58 @@
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def addressbookUnderTest(self, txn=None, name="addressbook", home="home1"):
</span><span class="cx"> """
</span><del>- Get the addressbook detailed by C{requirements['home1']['addressbook']}.
</del><ins>+ Get the addressbook detailed by
+ C{requirements['home1']['addressbook']}.
</ins><span class="cx"> """
</span><del>- returnValue((
- yield (yield self.addressbookHomeUnderTest(txn=txn, name=home)).addressbookWithName(name)
- ))
</del><ins>+ home = yield self.addressbookHomeUnderTest(txn=txn, name=home)
+ addressbook = yield home.addressbookWithName(name)
+ returnValue(addressbook)
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def addressbookObjectUnderTest(self, txn=None, name="1.vcf", addressbook_name="addressbook", home="home1"):
</del><ins>+ def addressbookObjectUnderTest(
+ self, txn=None, name="1.vcf",
+ addressbook_name="addressbook", home="home1",
+ ):
</ins><span class="cx"> """
</span><span class="cx"> Get the addressbook detailed by
</span><span class="cx"> C{requirements['home1']['addressbook']['1.vcf']}.
</span><span class="cx"> """
</span><del>- returnValue((yield (yield self.addressbookUnderTest(txn=txn, name=addressbook_name, home=home))
- .addressbookObjectWithName(name)))
</del><ins>+ addressBook = yield self.addressbookUnderTest(
+ txn=txn, name=addressbook_name, home=home
+ )
+ object = yield addressBook.addressbookObjectWithName(name)
+ returnValue(object)
</ins><span class="cx">
</span><span class="cx">
</span><del>- @inlineCallbacks
</del><span class="cx"> def userRecordWithShortName(self, shortname):
</span><del>- record = yield self.directory.recordWithShortName(self.directory.recordType.user, shortname)
- returnValue(record)
</del><ins>+ return self.directory.recordWithShortName(
+ self.directory.recordType.user, shortname
+ )
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def userUIDFromShortName(self, shortname):
</span><del>- record = yield self.directory.recordWithShortName(self.directory.recordType.user, shortname)
</del><ins>+ record = yield self.directory.recordWithShortName(
+ self.directory.recordType.user, shortname
+ )
</ins><span class="cx"> returnValue(record.uid if record is not None else None)
</span><span class="cx">
</span><span class="cx">
</span><del>- @inlineCallbacks
</del><span class="cx"> def addRecordFromFields(self, fields):
</span><span class="cx"> updatedRecord = DirectoryRecord(self.directory, fields)
</span><del>- yield self.directory.updateRecords((updatedRecord,), create=True)
</del><ins>+ return self.directory.updateRecords((updatedRecord,), create=True)
</ins><span class="cx">
</span><span class="cx">
</span><del>- @inlineCallbacks
</del><span class="cx"> def removeRecord(self, uid):
</span><del>- yield self.directory.removeRecords([uid])
</del><ins>+ return self.directory.removeRecords([uid])
</ins><span class="cx">
</span><span class="cx">
</span><del>- @inlineCallbacks
</del><span class="cx"> def changeRecord(self, record, fieldname, value):
</span><span class="cx"> fields = record.fields.copy()
</span><span class="cx"> fields[fieldname] = value
</span><span class="cx"> updatedRecord = DirectoryRecord(self.directory, fields)
</span><del>- yield self.directory.updateRecords((updatedRecord,))
</del><ins>+ return self.directory.updateRecords((updatedRecord,))
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>