[CalendarServer-changes] [9541] CalendarServer/branches/users/gaya/inviteclean/txdav/common/ datastore/sql.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 7 22:19:23 PDT 2012
Revision: 9541
http://trac.macosforge.org/projects/calendarserver/changeset/9541
Author: gaya at apple.com
Date: 2012-08-07 22:19:21 -0700 (Tue, 07 Aug 2012)
Log Message:
-----------
fix CommonHomeChild.objectWithName()
Modified Paths:
--------------
CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py
Modified: CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py 2012-08-08 00:42:15 UTC (rev 9540)
+++ CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py 2012-08-08 05:19:21 UTC (rev 9541)
@@ -1909,13 +1909,12 @@
@classproperty
- def _childListQuery(cls): #@NoSelf
+ def _childNamesForHomeID(cls): #@NoSelf
bind = cls._bindSchema
return Select([bind.RESOURCE_NAME], From=bind,
Where=(bind.HOME_RESOURCE_ID ==
- Parameter("resourceID")).And(
- (bind.BIND_MODE == _BIND_MODE_OWN).Or(
- bind.BIND_STATUS == _BIND_STATUS_ACCEPTED)))
+ Parameter("homeID")).And
+ (bind.BIND_STATUS == _BIND_STATUS_ACCEPTED))
@classmethod
@@ -1957,8 +1956,8 @@
@return: an iterable of C{str}s.
"""
# FIXME: tests don't cover this as directly as they should.
- rows = yield cls._childListQuery.on(
- home._txn, resourceID=home._resourceID)
+ rows = yield cls._childNamesForHomeID.on(
+ home._txn, homeID=home._resourceID)
names = [row[0] for row in rows]
returnValue(names)
@@ -1967,7 +1966,7 @@
def _invitedBindForHomeID(cls): #@NoSelf
bind = cls._bindSchema
return cls._bindFor((bind.HOME_RESOURCE_ID == Parameter("homeID"))
- .And(bind.BIND_STATUS != _BIND_STATUS_ACCEPTED))
+ .And(bind.BIND_STATUS != _BIND_STATUS_ACCEPTED))
@classmethod
@inlineCallbacks
@@ -1985,7 +1984,7 @@
@classproperty
- def _allHomeChildrenQuery(cls): #@NoSelf
+ def _childrenAndMetadataForHomeID(cls): #@NoSelf
bind = cls._bindSchema
child = cls._homeChildSchema
childMetaData = cls._homeChildMetaDataSchema
@@ -2004,9 +2003,7 @@
childMetaData, childMetaData.RESOURCE_ID == bind.RESOURCE_ID,
'left outer'),
Where=(bind.HOME_RESOURCE_ID == Parameter("homeID")
- ).And(
- (bind.BIND_MODE == _BIND_MODE_OWN).Or(
- bind.BIND_STATUS == _BIND_STATUS_ACCEPTED)))
+ ).And(bind.BIND_STATUS == _BIND_STATUS_ACCEPTED))
@classmethod
@@ -2371,7 +2368,7 @@
results = []
# Load from the main table first
- dataRows = (yield cls._allHomeChildrenQuery.on(home._txn, homeID=home._resourceID))
+ dataRows = (yield cls._childrenAndMetadataForHomeID.on(home._txn, homeID=home._resourceID))
if dataRows:
@@ -2454,10 +2451,11 @@
@classproperty
- def _bindForNameAndHomeID(cls): #@NoSelf
+ def _childForNameAndHomeID(cls): #@NoSelf
bind = cls._bindSchema
return cls._bindFor((bind.RESOURCE_NAME == Parameter("name"))
.And(bind.HOME_RESOURCE_ID == Parameter("homeID"))
+ .And(bind.BIND_STATUS == _BIND_STATUS_ACCEPTED)
)
@classmethod
@@ -2494,7 +2492,7 @@
if rows is None:
# No cached copy
- rows = yield cls._bindForNameAndHomeID.on(home._txn, name=name, homeID=home._resourceID)
+ rows = yield cls._childForNameAndHomeID.on(home._txn, name=name, homeID=home._resourceID)
if rows and queryCacher and rows[0][0] == _BIND_MODE_OWN:
# Cache the result
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120807/7df97697/attachment-0001.html>
More information about the calendarserver-changes
mailing list