[CalendarServer-changes] [13718] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jul 3 11:26:34 PDT 2014
Revision: 13718
http://trac.calendarserver.org//changeset/13718
Author: cdaboo at apple.com
Date: 2014-07-03 11:26:34 -0700 (Thu, 03 Jul 2014)
Log Message:
-----------
Missing yields.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/dbinspect.py
CalendarServer/trunk/calendarserver/tools/gateway.py
CalendarServer/trunk/calendarserver/tools/shell/cmd.py
CalendarServer/trunk/calendarserver/tools/shell/directory.py
CalendarServer/trunk/calendarserver/tools/shell/vfs.py
CalendarServer/trunk/contrib/performance/loadtest/ical.py
CalendarServer/trunk/requirements-dev.txt
CalendarServer/trunk/requirements-stable.txt
CalendarServer/trunk/twistedcaldav/directory/augment.py
CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py
CalendarServer/trunk/twistedcaldav/directory/digest.py
CalendarServer/trunk/twistedcaldav/resource.py
CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/resource.py
CalendarServer/trunk/twistedcaldav/storebridge.py
CalendarServer/trunk/txdav/caldav/datastore/schedule.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
CalendarServer/trunk/txdav/carddav/datastore/sql.py
CalendarServer/trunk/txdav/who/augment.py
Modified: CalendarServer/trunk/calendarserver/tools/dbinspect.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dbinspect.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/calendarserver/tools/dbinspect.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -96,26 +96,27 @@
+ at inlineCallbacks
def UserNameFromUID(txn, uid):
- record = txn.directoryService().recordWithGUID(uid)
- return record.shortNames[0] if record else "(%s)" % (uid,)
+ record = yield txn.directoryService().recordWithGUID(uid)
+ returnValue(record.shortNames[0] if record else "(%s)" % (uid,))
-
+ at inlineCallbacks
def UIDFromInput(txn, value):
try:
return str(UUID(value)).upper()
except (ValueError, TypeError):
pass
- record = txn.directoryService().recordWithShortName(RecordType.user, value)
+ record = yield txn.directoryService().recordWithShortName(RecordType.user, value)
if record is None:
- record = txn.directoryService().recordWithShortName(CalRecordType.location, value)
+ record = yield txn.directoryService().recordWithShortName(CalRecordType.location, value)
if record is None:
- record = txn.directoryService().recordWithShortName(CalRecordType.resource, value)
+ record = yield txn.directoryService().recordWithShortName(CalRecordType.resource, value)
if record is None:
- record = txn.directoryService().recordWithShortName(RecordType.group, value)
- return record.guid if record else None
+ record = yield txn.directoryService().recordWithShortName(RecordType.group, value)
+ returnValue(record.guid if record else None)
@@ -184,7 +185,7 @@
table = tables.Table()
table.addHeader(("Owner UID", "Short Name"))
for uid in sorted(uids):
- shortname = UserNameFromUID(txn, uid)
+ shortname = yield UserNameFromUID(txn, uid)
if shortname.startswith("("):
missing += 1
table.addRow((
@@ -230,7 +231,7 @@
table.addHeader(("Owner UID", "Short Name", "Calendars", "Resources"))
totals = [0, 0, 0]
for uid in sorted(results.keys()):
- shortname = UserNameFromUID(txn, uid)
+ shortname = yield UserNameFromUID(txn, uid)
table.addRow((
uid,
shortname,
@@ -287,7 +288,7 @@
table = tables.Table()
table.addHeader(("Owner UID", "Short Name", "Calendar", "Resources"))
for uid, calname, count in sorted(uids, key=lambda x: (x[0], x[1])):
- shortname = UserNameFromUID(txn, uid)
+ shortname = yield UserNameFromUID(txn, uid)
table.addRow((
uid,
shortname,
@@ -329,7 +330,7 @@
def doIt(self, txn):
uid = raw_input("Owner UID/Name: ")
- uid = UIDFromInput(txn, uid)
+ uid = yield UIDFromInput(txn, uid)
uids = yield self.getCalendars(txn, uid)
# Print table of results
@@ -337,7 +338,7 @@
table.addHeader(("Owner UID", "Short Name", "Calendars", "ID", "Resources"))
totals = [0, 0, ]
for uid, calname, resid, count in sorted(uids, key=lambda x: x[1]):
- shortname = UserNameFromUID(txn, uid)
+ shortname = yield UserNameFromUID(txn, uid)
table.addRow((
uid if totals[0] == 0 else "",
shortname if totals[0] == 0 else "",
@@ -390,7 +391,7 @@
table = tables.Table()
table.addHeader(("Owner UID", "Short Name", "Calendar", "ID", "Type", "UID"))
for uid, calname, id, caltype, caluid in sorted(uids, key=lambda x: (x[0], x[1])):
- shortname = UserNameFromUID(txn, uid)
+ shortname = yield UserNameFromUID(txn, uid)
table.addRow((
uid,
shortname,
@@ -484,9 +485,10 @@
"""
Base class for common event details commands.
"""
+ @inlineCallbacks
def printEventDetails(self, txn, details):
owner, calendar, resource_id, resource, created, modified, data = details
- shortname = UserNameFromUID(txn, owner)
+ shortname = yield UserNameFromUID(txn, owner)
table = tables.Table()
table.addRow(("Owner UID:", owner,))
table.addRow(("User Name:", shortname,))
@@ -540,7 +542,7 @@
returnValue(None)
result = yield self.getData(txn, rid)
if result:
- self.printEventDetails(txn, result[0])
+ yield self.printEventDetails(txn, result[0])
else:
print("Could not find resource")
@@ -562,7 +564,7 @@
rows = yield self.getData(txn, uid)
if rows:
for result in rows:
- self.printEventDetails(txn, result)
+ yield self.printEventDetails(txn, result)
else:
print("Could not find icalendar data")
@@ -584,7 +586,7 @@
rows = yield self.getData(txn, name)
if rows:
for result in rows:
- self.printEventDetails(txn, result)
+ yield self.printEventDetails(txn, result)
else:
print("Could not find icalendar data")
@@ -603,11 +605,11 @@
def doIt(self, txn):
uid = raw_input("Owner UID/Name: ")
- uid = UIDFromInput(txn, uid)
+ uid = yield UIDFromInput(txn, uid)
rows = yield self.getData(txn, uid)
if rows:
for result in rows:
- self.printEventDetails(txn, result)
+ yield self.printEventDetails(txn, result)
else:
print("Could not find icalendar data")
@@ -626,12 +628,12 @@
def doIt(self, txn):
uid = raw_input("Owner UID/Name: ")
- uid = UIDFromInput(txn, uid)
+ uid = yield UIDFromInput(txn, uid)
name = raw_input("Calendar resource name: ")
rows = yield self.getData(txn, uid, name)
if rows:
for result in rows:
- self.printEventDetails(txn, result)
+ yield self.printEventDetails(txn, result)
else:
print("Could not find icalendar data")
@@ -661,7 +663,7 @@
rows = yield self.getData(txn, homeName, calendarName, resourceName)
if rows:
for result in rows:
- self.printEventDetails(txn, result)
+ yield self.printEventDetails(txn, result)
else:
print("Could not find icalendar data")
@@ -693,7 +695,7 @@
rows = yield self.getData(txn, uid)
if rows:
for result in rows:
- self.printEventDetails(txn, result)
+ yield self.printEventDetails(txn, result)
else:
print("Could not find icalendar data")
Modified: CalendarServer/trunk/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/gateway.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/calendarserver/tools/gateway.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -380,7 +380,7 @@
self.respondWithError("Principal not found: %s" % (uid,))
return
recordDict = recordToDict(record)
- # recordDict['AutoSchedule'] = principal.getAutoSchedule()
+ # recordDict['AutoSchedule'] = yield principal.getAutoSchedule()
try:
recordDict['AutoAcceptGroup'] = record.autoAcceptGroup
except AttributeError:
@@ -398,7 +398,7 @@
# Resources
def command_getResourceList(self, command):
- self.respondWithRecordsOfTypes(self.dir, command, ["resources"])
+ return self.respondWithRecordsOfTypes(self.dir, command, ["resources"])
# deferred
@@ -416,7 +416,7 @@
def _delete(self, typeName, command):
uid = command['GeneratedUID']
yield self.dir.removeRecords([uid])
- self.respondWithRecordsOfTypes(self.dir, command, [typeName])
+ yield self.respondWithRecordsOfTypes(self.dir, command, [typeName])
@inlineCallbacks
Modified: CalendarServer/trunk/calendarserver/tools/shell/cmd.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/cmd.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/calendarserver/tools/shell/cmd.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -163,6 +163,7 @@
returnValue(())
+ @inlineCallbacks
def directoryRecordWithID(self, id):
"""
Obtains a directory record corresponding to the given C{id}.
@@ -173,7 +174,7 @@
"""
directory = self.protocol.service.directory
- record = directory.recordWithUID(id)
+ record = yield directory.recordWithUID(id)
if not record:
# Try type:name form
@@ -182,9 +183,9 @@
except ValueError:
pass
else:
- record = directory.recordWithShortName(recordType, shortName)
+ record = yield directory.recordWithShortName(recordType, shortName)
- return record
+ returnValue(record)
def commands(self, showHidden=False):
@@ -628,7 +629,7 @@
directory = self.protocol.service.directory
- record = self.directoryRecordWithID(id)
+ record = yield self.directoryRecordWithID(id)
if record:
self.terminal.write((yield recordInfo(directory, record)))
@@ -657,7 +658,7 @@
records = []
for id in tokens:
- record = self.directoryRecordWithID(id)
+ record = yield self.directoryRecordWithID(id)
records.append(record)
if not record:
@@ -701,6 +702,7 @@
# Sharing
#
+ @inlineCallbacks
def cmd_share(self, tokens):
"""
Share a resource with a principal.
@@ -715,12 +717,12 @@
mode = tokens.pop(0)
principalID = tokens.pop(0)
- record = self.directoryRecordWithID(principalID)
+ record = yield self.directoryRecordWithID(principalID)
if not record:
self.terminal.write("Principal not found: %s\n" % (principalID,))
- targets = self.getTargets(tokens)
+ targets = yield self.getTargets(tokens)
if mode == "r":
mode = None
Modified: CalendarServer/trunk/calendarserver/tools/shell/directory.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/directory.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/calendarserver/tools/shell/directory.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -155,7 +155,7 @@
# I don't know how to get DirectoryRecord objects for the proxyUID here, so, let's cheat for now.
proxyUID, proxyType = proxyUID.split("#")
if (proxyUID, proxyType) not in proxyInfoSeen:
- proxyRecord = directory.recordWithUID(proxyUID)
+ proxyRecord = yield directory.recordWithUID(proxyUID)
rows.append((proxyUID, proxyRecord.recordType, proxyRecord.shortNames[0], proxyRecord.fullName, proxyType))
proxyInfoSeen.add((proxyUID, proxyType))
Modified: CalendarServer/trunk/calendarserver/tools/shell/vfs.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/vfs.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/calendarserver/tools/shell/vfs.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -290,10 +290,11 @@
# FIXME: Merge in directory UIDs also?
# FIXME: Add directory info (eg. name) to list entry
+ @inlineCallbacks
def addResult(ignoredTxn, home):
uid = home.uid()
- record = self.service.directory.recordWithUID(uid)
+ record = yield self.service.directory.recordWithUID(uid)
if record:
info = {
"Record Type": record.recordType,
@@ -331,12 +332,13 @@
)
+ @inlineCallbacks
def list(self):
names = set()
- for record in self.service.directory.recordsWithRecordType(
+ for record in (yield self.service.directory.recordsWithRecordType(
self.recordType
- ):
+ )):
for shortName in record.shortNames:
if shortName in names:
continue
@@ -395,6 +397,7 @@
Folder.__init__(self, service, path)
if record is None:
+ # FIXME: recordWithUID returns a Deferred but we cannot return or yield it in an __init__ method
record = self.service.directory.recordWithUID(uid)
if record is not None:
Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -1477,7 +1477,7 @@
)
# Finally, re-retrieve the event to update the etag
- self._updateEvent(response, href)
+ yield self._updateEvent(response, href)
@inlineCallbacks
Modified: CalendarServer/trunk/requirements-dev.txt
===================================================================
--- CalendarServer/trunk/requirements-dev.txt 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/requirements-dev.txt 2014-07-03 18:26:34 UTC (rev 13718)
@@ -7,4 +7,4 @@
mockldap
q
--editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk@13420#egg=CalDAVClientLibrary
---editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@13714#egg=CalDAVTester
+--editable svn+http://svn.calendarserver.org/repository/calendarserver/CalDAVTester/trunk@13716#egg=CalDAVTester
Modified: CalendarServer/trunk/requirements-stable.txt
===================================================================
--- CalendarServer/trunk/requirements-stable.txt 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/requirements-stable.txt 2014-07-03 18:26:34 UTC (rev 13718)
@@ -5,7 +5,7 @@
# For CalendarServer development, don't try to get these projects from PyPI; use svn.
-e .
--e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13696#egg=twextpy
+-e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13717#egg=twextpy
-e svn+http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk@13420#egg=kerberos
-e svn+http://svn.calendarserver.org/repository/calendarserver/PyCalendar/trunk@13711#egg=pycalendar
Modified: CalendarServer/trunk/twistedcaldav/directory/augment.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/augment.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/twistedcaldav/directory/augment.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -504,8 +504,7 @@
Remove all records.
"""
- self.removeAugmentRecords(self.db.keys())
- return succeed(None)
+ return self.removeAugmentRecords(self.db.keys())
def _shouldReparse(self, xmlFiles):
Modified: CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -858,7 +858,7 @@
yield self.open()
for group in [row[0] for row in (yield self.query("select GROUPNAME from GROUPS"))]:
- self.removeGroup(group)
+ yield self.removeGroup(group)
yield super(ProxyDB, self).clean()
Modified: CalendarServer/trunk/twistedcaldav/directory/digest.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/digest.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/twistedcaldav/directory/digest.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -167,8 +167,7 @@
header.
"""
- challenge = yield (super(QopDigestCredentialFactory, self)
- .getChallenge(peer))
+ challenge = yield (super(QopDigestCredentialFactory, self).getChallenge(peer))
c = challenge['nonce']
# Make sure it is not a duplicate
Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/twistedcaldav/resource.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -1884,7 +1884,7 @@
))
# elif name == "auto-schedule" and self.calendarsEnabled():
- # autoSchedule = self.getAutoSchedule()
+ # autoSchedule = yield self.getAutoSchedule()
# returnValue(customxml.AutoSchedule("true" if autoSchedule else "false"))
elif name == "auto-schedule-mode" and self.calendarsEnabled():
Modified: CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/resource.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/resource.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -541,7 +541,8 @@
)
)
else:
- returnValue(super(ScheduleOutboxResource, self).defaultAccessControlList())
+ result = yield super(ScheduleOutboxResource, self).defaultAccessControlList()
+ returnValue(result)
def report_urn_ietf_params_xml_ns_caldav_calendar_query(self, request, calendar_query):
Modified: CalendarServer/trunk/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/storebridge.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -3804,7 +3804,7 @@
@return: a sequence of the names of all known children of this resource.
"""
children = set(self.putChildren.keys())
- children.update(self._newStoreNotifications.listNotificationObjects())
+ children.update((yield self._newStoreNotifications.listNotificationObjects()))
returnValue(children)
Modified: CalendarServer/trunk/txdav/caldav/datastore/schedule.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/schedule.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/txdav/caldav/datastore/schedule.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -43,8 +43,7 @@
@inlineCallbacks
def calendarHomeWithUID(self, uid, create=False):
# FIXME: 'create' flag
- newHome = yield super(ImplicitTransaction, self
- ).calendarHomeWithUID(uid, create)
+ newHome = yield super(ImplicitTransaction, self).calendarHomeWithUID(uid, create)
# return ImplicitCalendarHome(newHome, self)
if newHome is None:
returnValue(None)
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -463,7 +463,7 @@
if send_reply:
# Track outstanding auto-reply processing
log.debug("ImplicitProcessing - recipient '%s' processing UID: '%s' - auto-reply queued" % (self.recipient.cuaddr, self.uid,))
- ScheduleAutoReplyWork.autoReply(self.txn, new_resource, partstat)
+ yield ScheduleAutoReplyWork.autoReply(self.txn, new_resource, partstat)
# Build the schedule-changes XML element
changes = customxml.ScheduleChanges(
@@ -511,7 +511,7 @@
if send_reply:
# Track outstanding auto-reply processing
log.debug("ImplicitProcessing - recipient '%s' processing UID: '%s' - auto-reply queued" % (self.recipient.cuaddr, self.uid,))
- ScheduleAutoReplyWork.autoReply(self.txn, new_resource, partstat)
+ yield ScheduleAutoReplyWork.autoReply(self.txn, new_resource, partstat)
# Build the schedule-changes XML element
update_details = []
Modified: CalendarServer/trunk/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/sql.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/txdav/carddav/datastore/sql.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -224,7 +224,7 @@
Unbinds any collections that have been shared to this home but not yet
accepted. Associated invite entries are also removed.
"""
- super(AddressBookHome, self).removeUnacceptedShares()
+ yield super(AddressBookHome, self).removeUnacceptedShares()
# Remove group binds too
bind = AddressBookObject._bindSchema
@@ -805,7 +805,7 @@
self.ownerHome()._addressbookPropertyStoreID, # not ._resourceID as in CommonHomeChild._loadPropertyStore()
notifyCallback=self.notifyPropertyChanged
)
- super(AddressBook, self)._loadPropertyStore(props)
+ yield super(AddressBook, self)._loadPropertyStore(props)
def initPropertyStore(self, props):
@@ -868,7 +868,7 @@
@inlineCallbacks
def removedObjectResource(self, child):
"""
- just like CommonHomeChild.removedObjectResource() but does not call self._deleteRevision()
+ Just like CommonHomeChild.removedObjectResource() but does not call self._deleteRevision()
"""
self._objects.pop(child.name(), None)
self._objects.pop(child.uid(), None)
Modified: CalendarServer/trunk/txdav/who/augment.py
===================================================================
--- CalendarServer/trunk/txdav/who/augment.py 2014-07-03 18:22:35 UTC (rev 13717)
+++ CalendarServer/trunk/txdav/who/augment.py 2014-07-03 18:26:34 UTC (rev 13718)
@@ -320,9 +320,10 @@
return (baseFields, augmentFields)
+ @inlineCallbacks
def removeRecords(self, uids):
- self._augmentDB.removeAugmentRecords(uids)
- return self._directory.removeRecords(uids)
+ yield self._augmentDB.removeAugmentRecords(uids)
+ yield self._directory.removeRecords(uids)
def _assignToField(self, fields, name, value):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140703/83012f30/attachment-0001.html>
More information about the calendarserver-changes
mailing list