[CalendarServer-changes] [6388] CalendarServer/branches/users/glyph/more-deferreds-7
source_changes at macosforge.org
source_changes at macosforge.org
Wed Sep 29 15:28:19 PDT 2010
Revision: 6388
http://trac.macosforge.org/projects/calendarserver/changeset/6388
Author: glyph at apple.com
Date: 2010-09-29 15:28:17 -0700 (Wed, 29 Sep 2010)
Log Message:
-----------
Asynchronize everything else except for write operations and component()
Modified Paths:
--------------
CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_calendar_query.py
CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_common.py
CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_multiget_common.py
CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_sync_collection.py
CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/resource.py
CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/sharing.py
CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/storebridge.py
CalendarServer/branches/users/glyph/more-deferreds-7/txdav/caldav/datastore/test/test_index_file.py
CalendarServer/branches/users/glyph/more-deferreds-7/txdav/common/datastore/sql_legacy.py
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_calendar_query.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_calendar_query.py 2010-09-29 18:40:57 UTC (rev 6387)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_calendar_query.py 2010-09-29 22:28:17 UTC (rev 6388)
@@ -175,12 +175,11 @@
try:
# Get list of children that match the search and have read
# access
- names = [name for name, ignore_uid, ignore_type
- in calresource.index().indexedSearch(filter)]
+ records = yield calresource.index().indexedSearch(filter)
except IndexedSearchException:
- names = [name for name, ignore_uid, ignore_type
- in calresource.index().bruteForceSearch()]
+ records = yield calresource.index().bruteForceSearch()
index_query_ok = False
+ names = [name for name, ignore_uid, ignore_type in records]
if not names:
returnValue(True)
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_common.py 2010-09-29 18:40:57 UTC (rev 6387)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_common.py 2010-09-29 22:28:17 UTC (rev 6388)
@@ -383,9 +383,12 @@
fbtype_mapper = {"BUSY": 0, "BUSY-TENTATIVE": 1, "BUSY-UNAVAILABLE": 2}
fbtype_index_mapper = {'B': 0, 'T': 1, 'U': 2}
+
+
@inlineCallbacks
def generateFreeBusyInfo(request, calresource, fbinfo, timerange, matchtotal,
- excludeuid=None, organizer=None, organizerPrincipal=None, same_calendar_user=False,
+ excludeuid=None, organizer=None,
+ organizerPrincipal=None, same_calendar_user=False,
servertoserver=False):
"""
Run a free busy report on the specified calendar collection
@@ -395,15 +398,18 @@
@param fbinfo: the array of busy periods to update.
@param timerange: the L{TimeRange} for the query.
@param matchtotal: the running total for the number of matches.
- @param excludeuid: a C{str} containing a UID value to exclude any components with that
- UID from contributing to free-busy.
- @param organizer: a C{str} containing the value of the ORGANIZER property in the VFREEBUSY request.
- This is used in conjunction with the UID value to process exclusions.
- @param same_calendar_user: a C{bool} indicating whether the calendar user requesting the free-busy information
- is the same as the calendar user being targeted.
- @param servertoserver: a C{bool} indicating whether we are doing a local or remote lookup request.
+ @param excludeuid: a C{str} containing a UID value to exclude any
+ components with that UID from contributing to free-busy.
+ @param organizer: a C{str} containing the value of the ORGANIZER property
+ in the VFREEBUSY request. This is used in conjunction with the UID
+ value to process exclusions.
+ @param same_calendar_user: a C{bool} indicating whether the calendar user
+ requesting the free-busy information is the same as the calendar user
+ being targeted.
+ @param servertoserver: a C{bool} indicating whether we are doing a local or
+ remote lookup request.
"""
-
+
# First check the privilege on this collection
# TODO: for server-to-server we bypass this right now as we have no way to authorize external users.
if not servertoserver:
@@ -443,16 +449,22 @@
tz = None
tzinfo = filter.settimezone(tz)
- # Do some optimization of access control calculation by determining any inherited ACLs outside of
- # the child resource loop and supply those to the checkPrivileges on each child.
+ # Do some optimization of access control calculation by determining any
+ # inherited ACLs outside of the child resource loop and supply those to the
+ # checkPrivileges on each child.
filteredaces = (yield calresource.inheritedACEsforChildren(request))
+ userPrincipal = (yield calresource.resourceOwnerPrincipal(request))
+ if userPrincipal:
+ useruid = userPrincipal.principalUID()
+ else:
+ useruid = ""
try:
- useruid = (yield calresource.resourceOwnerPrincipal(request))
- useruid = useruid.principalUID() if useruid else ""
- resources = calresource.index().indexedSearch(filter, useruid=useruid, fbtype=True)
+ resources = yield calresource.index().indexedSearch(
+ filter, useruid=useruid, fbtype=True
+ )
except IndexedSearchException:
- resources = calresource.index().bruteForceSearch()
+ resources = yield calresource.index().bruteForceSearch()
# We care about separate instances for VEVENTs only
aggregated_resources = {}
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_multiget_common.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_multiget_common.py 2010-09-29 18:40:57 UTC (rev 6387)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_multiget_common.py 2010-09-29 22:28:17 UTC (rev 6388)
@@ -179,7 +179,9 @@
returnValue(None)
# Verify that valid requested resources are calendar objects
- exists_names = tuple(self.index().resourcesExist(valid_names))
+ exists_names = tuple(
+ (yield self.index().resourcesExist(valid_names))
+ )
checked_names = []
for name in valid_names:
if name not in exists_names:
@@ -309,11 +311,11 @@
parent = (yield child.locateParent(request, resource_uri))
if collection_type == COLLECTION_TYPE_CALENDAR:
- if not parent.isCalendarCollection() or not parent.index().resourceExists(name):
+ if not parent.isCalendarCollection() or not (yield parent.index().resourceExists(name)):
responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
continue
elif collection_type == COLLECTION_TYPE_ADDRESSBOOK:
- if not parent.isAddressBookCollection() or not parent.index().resourceExists(name):
+ if not parent.isAddressBookCollection() or not (yield parent.index().resourceExists(name)):
responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
continue
@@ -343,11 +345,11 @@
parent = (yield self.locateParent(request, resource_uri))
if collection_type == COLLECTION_TYPE_CALENDAR:
- if not parent.isPseudoCalendarCollection() or not parent.index().resourceExists(name):
+ if not parent.isPseudoCalendarCollection() or not (yield parent.index().resourceExists(name)):
responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
continue
elif collection_type == COLLECTION_TYPE_ADDRESSBOOK:
- if not parent.isAddressBookCollection() or not parent.index().resourceExists(name):
+ if not parent.isAddressBookCollection() or not (yield parent.index().resourceExists(name)):
responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
continue
child = self
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_sync_collection.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_sync_collection.py 2010-09-29 18:40:57 UTC (rev 6387)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/method/report_sync_collection.py 2010-09-29 22:28:17 UTC (rev 6388)
@@ -102,7 +102,7 @@
# the child resource loop and supply those to the checkPrivileges on each child.
filteredaces = (yield self.inheritedACEsforChildren(request))
- changed, removed, newtoken = self.whatchanged(sync_collection.sync_token)
+ changed, removed, newtoken = yield self.whatchanged(sync_collection.sync_token)
# Now determine which valid resources are readable and which are not
ok_resources = []
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/resource.py 2010-09-29 18:40:57 UTC (rev 6387)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/resource.py 2010-09-29 22:28:17 UTC (rev 6388)
@@ -178,7 +178,10 @@
calendarPrivilegeSet = _calendarPrivilegeSet()
-class CalDAVResource (CalDAVComplianceMixIn, SharedCollectionMixin, DAVResourceWithChildrenMixin, DAVResource, LoggingMixIn):
+class CalDAVResource (
+ CalDAVComplianceMixIn, SharedCollectionMixin,
+ DAVResourceWithChildrenMixin, DAVResource, LoggingMixIn
+ ):
"""
CalDAV resource.
@@ -534,12 +537,12 @@
elif qname == customxml.GETCTag.qname() and (
self.isPseudoCalendarCollection() or self.isAddressBookCollection()
):
- returnValue(customxml.GETCTag.fromString(self.getSyncToken()))
+ returnValue(customxml.GETCTag.fromString((yield self.getSyncToken())))
elif qname == davxml.SyncToken.qname() and config.EnableSyncReport and (
self.isPseudoCalendarCollection() or self.isAddressBookCollection()
):
- returnValue(davxml.SyncToken.fromString(self.getSyncToken()))
+ returnValue(davxml.SyncToken.fromString((yield self.getSyncToken())))
elif qname == davxml.AddMember.qname() and config.EnableAddMember and (
self.isCalendarCollection() or self.isAddressBookCollection()
@@ -1313,9 +1316,10 @@
# Collection sync stuff
+
+ @inlineCallbacks
def whatchanged(self, client_token):
-
- current_token = self.getSyncToken()
+ current_token = yield self.getSyncToken()
current_uuid, current_revision = current_token.split("#", 1)
current_revision = int(current_revision)
@@ -1335,11 +1339,11 @@
revision = 0
try:
- changed, removed = self._indexWhatChanged(revision)
+ changed, removed = yield self._indexWhatChanged(revision)
except SyncTokenValidException:
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (dav_namespace, "valid-sync-token")))
- return changed, removed, current_token
+ returnValue((changed, removed, current_token))
def _indexWhatChanged(self, revision):
return self.index().whatchanged(revision)
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/sharing.py 2010-09-29 18:40:57 UTC (rev 6387)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/sharing.py 2010-09-29 22:28:17 UTC (rev 6388)
@@ -54,22 +54,22 @@
class SharedCollectionMixin(object):
+ @inlineCallbacks
def inviteProperty(self, request):
"""
Calculate the customxml.Invite property (for readProperty) from the
invites database.
"""
+ isShared = yield self.isShared(request)
+ if config.Sharing.Enabled and isShared:
+ yield self.validateInvites()
+ records = yield self.invitesDB().allRecords()
+ returnValue(customxml.Invite(
+ *[record.makePropertyElement() for record in records]
+ ))
+ else:
+ returnValue(None)
- def sharedOK(isShared):
- if config.Sharing.Enabled and isShared:
- self.validateInvites()
- return customxml.Invite(
- *[record.makePropertyElement() for
- record in self.invitesDB().allRecords()]
- )
- else:
- return None
- return self.isShared(request).addCallback(sharedOK)
def upgradeToShare(self):
""" Upgrade this collection to a shared state """
@@ -92,7 +92,7 @@
self.writeDeadProperty(rtype)
# Remove all invitees
- for record in self.invitesDB().allRecords():
+ for record in (yield self.invitesDB().allRecords()):
yield self.uninviteRecordFromShare(record, request)
# Remove invites database
@@ -390,17 +390,20 @@
else:
return None, None, None
+
+ @inlineCallbacks
def validateInvites(self):
"""
Make sure each userid in an invite is valid - if not re-write status.
"""
- records = self.invitesDB().allRecords()
+ records = yield self.invitesDB().allRecords()
for record in records:
if self.validUserIDForShare(record.userid) is None and record.state != "INVALID":
record.state = "INVALID"
self.invitesDB().addOrUpdateRecord(record)
-
+
+
def inviteUserToShare(self, userid, cn, ace, summary, request):
""" Send out in invite first, and then add this user to the share list
@param userid:
@@ -467,7 +470,7 @@
returnValue(False)
# Look for existing invite and update its fields or create new one
- record = self.invitesDB().recordForPrincipalURL(principalURL)
+ record = yield self.invitesDB().recordForPrincipalURL(principalURL)
if record:
record.name = cn
record.access = inviteAccessMapFromXML[type(ace)]
@@ -483,12 +486,18 @@
returnValue(True)
+
+ @inlineCallbacks
def uninviteSingleUserFromShare(self, userid, aces, request):
-
# Cancel invites - we'll just use whatever userid we are given
- record = self.invitesDB().recordForUserID(userid)
- return self.uninviteRecordFromShare(record, request) if record else succeed(True)
-
+ record = yield self.invitesDB().recordForUserID(userid)
+ if record:
+ result = (yield self.uninviteRecordFromShare(record, request))
+ else:
+ result = True
+ returnValue(result)
+
+
@inlineCallbacks
def uninviteRecordFromShare(self, record, request):
@@ -685,7 +694,7 @@
(okusers if result else badusers).add(userid)
# Do a final validation of the entire set of invites
- self.validateInvites()
+ yield self.validateInvites()
# Create the multistatus response - only needed if some are bad
if badusers:
@@ -986,7 +995,7 @@
def _acceptShare(self, request, sharetype, hostUrl, shareUID, displayname=None):
# Add or update in DB
- oldShare = self.sharesDB().recordForShareUID(shareUID)
+ oldShare = yield self.sharesDB().recordForShareUID(shareUID)
if oldShare:
share = oldShare
else:
@@ -1028,7 +1037,7 @@
def removeShareByUID(self, request, shareUID):
""" Remove a shared collection but do not send a decline back """
- share = self.sharesDB().recordForShareUID(shareUID)
+ share = yield self.sharesDB().recordForShareUID(shareUID)
if share:
yield self.removeDirectShare(request, share)
@@ -1218,12 +1227,8 @@
records = self._db_execute("select * from SHARES order by LOCALNAME")
return [self._makeRecord(row) for row in (records if records is not None else ())]
-
- def recordForLocalName(self, localname):
-
- row = self._db_execute("select * from SHARES where LOCALNAME = :1", localname)
- return self._makeRecord(row[0]) if row else None
-
+
+
def recordForShareUID(self, shareUID):
row = self._db_execute("select * from SHARES where SHAREUID = :1", shareUID)
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/storebridge.py 2010-09-29 18:40:57 UTC (rev 6387)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/twistedcaldav/storebridge.py 2010-09-29 22:28:17 UTC (rev 6388)
@@ -275,13 +275,14 @@
returnValue(similar)
+ @inlineCallbacks
def listChildren(self):
"""
@return: a sequence of the names of all known children of this resource.
"""
children = set(self.putChildren.keys())
- children.update(self._newStoreCalendar.listCalendarObjects())
- return sorted(children)
+ children.update((yield self._newStoreCalendar.listCalendarObjects()))
+ returnValue(sorted(children))
def quotaSize(self, request):
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/txdav/caldav/datastore/test/test_index_file.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/txdav/caldav/datastore/test/test_index_file.py 2010-09-29 18:40:57 UTC (rev 6387)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/txdav/caldav/datastore/test/test_index_file.py 2010-09-29 22:28:17 UTC (rev 6388)
@@ -30,6 +30,7 @@
import datetime
import os
+from twisted.internet.defer import inlineCallbacks
class MinimalResourceReplacement(object):
@@ -282,6 +283,8 @@
else:
self.assertFalse(self.db.resourceExists(name), msg=description)
+
+ @inlineCallbacks
def test_index_timespan(self):
data = (
(
@@ -452,7 +455,7 @@
)
filter = calendarqueryfilter.Filter(filter)
- resources = self.db.indexedSearch(filter, fbtype=True)
+ resources = yield self.db.indexedSearch(filter, fbtype=True)
index_results = set()
for _ignore_name, _ignore_uid, type, test_organizer, float, start, end, fbtype, transp in resources:
self.assertEqual(test_organizer, organizer, msg=description)
@@ -460,6 +463,8 @@
self.assertEqual(set(instances), index_results, msg=description)
+
+ @inlineCallbacks
def test_index_timespan_per_user(self):
data = (
(
@@ -850,7 +855,7 @@
filter = calendarqueryfilter.Filter(filter)
for useruid, instances in peruserinstances:
- resources = self.db.indexedSearch(filter, useruid=useruid, fbtype=True)
+ resources = yield self.db.indexedSearch(filter, useruid=useruid, fbtype=True)
index_results = set()
for _ignore_name, _ignore_uid, type, test_organizer, float, start, end, fbtype, transp in resources:
self.assertEqual(test_organizer, organizer, msg=description)
@@ -860,6 +865,7 @@
self.db.deleteResource(name)
+
def test_index_revisions(self):
data1 = """BEGIN:VCALENDAR
VERSION:2.0
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/txdav/common/datastore/sql_legacy.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/txdav/common/datastore/sql_legacy.py 2010-09-29 18:40:57 UTC (rev 6387)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/txdav/common/datastore/sql_legacy.py 2010-09-29 22:28:17 UTC (rev 6388)
@@ -174,10 +174,11 @@
return self._makeInvite(rows[0]) if rows else None
+ @inlineCallbacks
def recordForPrincipalURL(self, principalURL):
- for record in self.allRecords():
+ for record in (yield self.allRecords()):
if record.principalURL == principalURL:
- return record
+ returnValue(record)
def recordForInviteUID(self, inviteUID):
@@ -478,8 +479,6 @@
if getattr(record, key) == value:
return record
- def recordForLocalName(self, localname):
- return self._search(localname=localname)
def recordForShareUID(self, shareUID):
return self._search(shareuid=shareUID)
@@ -914,9 +913,10 @@
obj.updateDatabase(obj.component(), expand_until=expand_until, reCreate=True)
+ @inlineCallbacks
def testAndUpdateIndex(self, minDate):
# Find out if the index is expanded far enough
- names = self.notExpandedBeyond(minDate)
+ names = yield self.notExpandedBeyond(minDate)
# Actually expand recurrence max
for name in names:
@@ -925,7 +925,6 @@
def whatchanged(self, revision):
-
results = [
(name.encode("utf-8"), deleted)
for name, deleted in
@@ -936,7 +935,7 @@
)
]
results.sort(key=lambda x:x[1])
-
+
changed = []
deleted = []
for name, wasdeleted in results:
@@ -946,67 +945,87 @@
deleted.append(name)
else:
changed.append(name)
-
return changed, deleted,
+ @inlineCallbacks
def indexedSearch(self, filter, useruid='', fbtype=False):
"""
Finds resources matching the given qualifiers.
@param filter: the L{Filter} for the calendar-query to execute.
- @return: an iterable of tuples for each resource matching the
- given C{qualifiers}. The tuples are C{(name, uid, type)}, where
- C{name} is the resource name, C{uid} is the resource UID, and
- C{type} is the resource iCalendar component type.x
+
+ @return: a L{Deferred} which fires with an iterable of tuples for each
+ resource matching the given C{qualifiers}. The tuples are C{(name,
+ uid, type)}, where C{name} is the resource name, C{uid} is the
+ resource UID, and C{type} is the resource iCalendar component
+ type.
"""
-
# Make sure we have a proper Filter element and get the partial SQL
# statement to use.
if isinstance(filter, calendarqueryfilter.Filter):
- qualifiers = calendarquery.sqlcalendarquery(filter, self.calendar._resourceID, useruid, generator=postgresqlgenerator)
+ qualifiers = calendarquery.sqlcalendarquery(
+ filter, self.calendar._resourceID, useruid,
+ generator=postgresqlgenerator
+ )
if qualifiers is not None:
# Determine how far we need to extend the current expansion of
- # events. If we have an open-ended time-range we will expand one
- # year past the start. That should catch bounded recurrences - unbounded
- # will have been indexed with an "infinite" value always included.
+ # events. If we have an open-ended time-range we will expand
+ # one year past the start. That should catch bounded
+ # recurrences - unbounded will have been indexed with an
+ # "infinite" value always included.
maxDate, isStartDate = filter.getmaxtimerange()
if maxDate:
maxDate = maxDate.date()
if isStartDate:
maxDate += datetime.timedelta(days=365)
- self.testAndUpdateIndex(maxDate)
+ yield self.testAndUpdateIndex(maxDate)
else:
# We cannot handler this filter in an indexed search
raise IndexedSearchException()
-
else:
qualifiers = None
# Perform the search
if qualifiers is None:
- rowiter = self._txn.execSQL(
- "select RESOURCE_NAME, ICALENDAR_UID, ICALENDAR_TYPE from CALENDAR_OBJECT where CALENDAR_RESOURCE_ID = %s",
- [self.calendar._resourceID, ],
+ rowiter = yield self._txn.execSQL(
+ """
+ select RESOURCE_NAME, ICALENDAR_UID, ICALENDAR_TYPE
+ from CALENDAR_OBJECT where CALENDAR_RESOURCE_ID = %s
+ """,
+ [self.calendar._resourceID],
)
else:
if fbtype:
# For a free-busy time-range query we return all instances
- rowiter = self._txn.execSQL(
- """select DISTINCT
- CALENDAR_OBJECT.RESOURCE_NAME, CALENDAR_OBJECT.ICALENDAR_UID, CALENDAR_OBJECT.ICALENDAR_TYPE, CALENDAR_OBJECT.ORGANIZER,
- TIME_RANGE.FLOATING, TIME_RANGE.START_DATE, TIME_RANGE.END_DATE, TIME_RANGE.FBTYPE, TIME_RANGE.TRANSPARENT, TRANSPARENCY.TRANSPARENT""" +
+ rowiter = yield self._txn.execSQL(
+ """
+ select DISTINCT
+ CALENDAR_OBJECT.RESOURCE_NAME,
+ CALENDAR_OBJECT.ICALENDAR_UID,
+ CALENDAR_OBJECT.ICALENDAR_TYPE,
+ CALENDAR_OBJECT.ORGANIZER,
+ TIME_RANGE.FLOATING, TIME_RANGE.START_DATE,
+ TIME_RANGE.END_DATE, TIME_RANGE.FBTYPE,
+ TIME_RANGE.TRANSPARENT, TRANSPARENCY.TRANSPARENT
+ """ +
qualifiers[0],
qualifiers[1]
)
else:
- rowiter = self._txn.execSQL(
- "select DISTINCT CALENDAR_OBJECT.RESOURCE_NAME, CALENDAR_OBJECT.ICALENDAR_UID, CALENDAR_OBJECT.ICALENDAR_TYPE" +
+ rowiter = yield self._txn.execSQL(
+ """
+ select
+ DISTINCT CALENDAR_OBJECT.RESOURCE_NAME,
+ CALENDAR_OBJECT.ICALENDAR_UID,
+ CALENDAR_OBJECT.ICALENDAR_TYPE
+ """ +
qualifiers[0],
qualifiers[1]
)
# Check result for missing resources
+ results = []
for row in rowiter:
if fbtype:
row = list(row)
@@ -1014,7 +1033,8 @@
row[7] = indexfbtype_to_icalfbtype[row[7]]
row[8] = 'T' if row[9] else 'F'
del row[9]
- yield row
+ results.append(row)
+ returnValue(results)
def bruteForceSearch(self):
@@ -1025,9 +1045,10 @@
)
+ @inlineCallbacks
def resourcesExist(self, names):
- return list(set(names).intersection(
- set(self.calendar.listCalendarObjects())))
+ returnValue(list(set(names).intersection(
+ set((yield self.calendar.listCalendarObjects())))))
def resourceExists(self, name):
@@ -1245,9 +1266,10 @@
)
+ @inlineCallbacks
def resourcesExist(self, names):
- return list(set(names).intersection(
- set(self.addressbook.listAddressbookObjects())))
+ returnValue(list(set(names).intersection(
+ set((yield self.addressbook.listAddressbookObjects())))))
def resourceExists(self, name):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100929/59b1247a/attachment-0001.html>
More information about the calendarserver-changes
mailing list