[CalendarServer-changes] [10954] CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/ datastore/sql.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 19 16:22:04 PDT 2013
Revision: 10954
http://trac.calendarserver.org//changeset/10954
Author: gaya at apple.com
Date: 2013-03-19 16:22:04 -0700 (Tue, 19 Mar 2013)
Log Message:
-----------
revert string formating
Modified Paths:
--------------
CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py 2013-03-19 22:59:36 UTC (rev 10953)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py 2013-03-19 23:22:04 UTC (rev 10954)
@@ -1,5 +1,5 @@
# -*- test-case-name: txdav.carddav.datastore.test.test_sql -*-
-# #
+##
# Copyright (c) 2010-2013 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-# #
+##
"""
SQL backend for CardDAV storage.
@@ -95,7 +95,7 @@
@classproperty
- def _resourceIDAndHomeResourceIDFromOwnerQuery(cls): # @NoSelf
+ def _resourceIDAndHomeResourceIDFromOwnerQuery(cls): #@NoSelf
home = cls._homeSchema
return Select([home.RESOURCE_ID, home.HOME_RESOURCE_ID],
From=home, Where=home.OWNER_UID == Parameter("ownerUID"))
@@ -133,7 +133,7 @@
# Cache the data
yield queryCacher.setAfterCommit(self._txn, cacheKey, data)
- # self._created, self._modified = data
+ #self._created, self._modified = data
yield self._loadPropertyStore()
# created owned address book
@@ -259,7 +259,7 @@
@classproperty
- def _syncTokenQuery(cls): # @NoSelf
+ def _syncTokenQuery(cls): #@NoSelf
"""
DAL Select statement to find the sync token.
"""
@@ -303,7 +303,7 @@
@classproperty
- def _changesQuery(cls): # @NoSelf
+ def _changesQuery(cls): #@NoSelf
rev = cls._revisionsSchema
return Select(
[rev.RESOURCE_NAME, rev.DELETED],
@@ -387,10 +387,10 @@
def resourceType(self):
- return ResourceType.addressbook # @UndefinedVariable
+ return ResourceType.addressbook #@UndefinedVariable
- # FIXME: Only used for shared group resouretype in SharedResourceMixin.upgradeToShare() and SharedResourceMixin.downgradeFromShare()
+ #FIXME: Only used for shared group resouretype in SharedResourceMixin.upgradeToShare() and SharedResourceMixin.downgradeFromShare()
def objectResourcesHaveProperties(self):
return True
@@ -432,10 +432,10 @@
@classmethod
def create(cls, home, name):
if name == home.addressbook().name():
- # raise HomeChildNameAlreadyExistsError
+ #raise HomeChildNameAlreadyExistsError
pass
else:
- # raise HomeChildNameNotAllowedError
+ #raise HomeChildNameNotAllowedError
raise HTTPError(FORBIDDEN)
@@ -450,7 +450,7 @@
yield self.unshare() # storebridge should already have done this
# don't delete. Note that revision table is NOT queried for removes
- # yield self._deletedSyncToken()
+ #yield self._deletedSyncToken()
yield self._updateRevision(self.name())
# TODO: See why the following 2 line do not work reliably
@@ -470,7 +470,7 @@
def rename(self, name):
# better error?
- # raise HomeChildNameNotAllowedError
+ #raise HomeChildNameNotAllowedError
raise HTTPError(FORBIDDEN)
@@ -493,7 +493,7 @@
)
count = rows[0][0]
- # add in group for shared address book
+ #add in group for shared address book
if not self.owned() and not self.fullyShared():
count += 1
returnValue(count)
@@ -520,7 +520,7 @@
@inlineCallbacks
- def _groupForEntireAB_Row(self): # @NoSelf
+ def _groupForEntireAB_Row(self): #@NoSelf
returnValue([
self._resourceID, # obj.ADDRESSBOOK_RESOURCE_ID,
@@ -616,7 +616,7 @@
)
# get ownerHomeIDs
for dataRow in dataRows:
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = dataRow[:6] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = dataRow[:6] #@UnusedVariable
assert bindStatus != _BIND_MODE_OWN
ownerHome = yield home.ownerHomeWithChildID(resourceID)
ownerHomeToDataRowMap[ownerHome] = dataRow
@@ -626,7 +626,7 @@
home._txn, homeID=home._resourceID
)
for groupBindRow in groupBindRows:
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRow[:6] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRow[:6] #@UnusedVariable
ownerAddressBookID = yield AddressBookObject.ownerAddressBookFromGroupID(home._txn, resourceID)
ownerHome = yield home.ownerHomeWithChildID(ownerAddressBookID)
if ownerHome not in ownerHomeToDataRowMap:
@@ -647,7 +647,7 @@
# Create the actual objects merging in properties
for ownerHome, dataRow in ownerHomeToDataRowMap.iteritems():
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = dataRow[:6] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = dataRow[:6] #@UnusedVariable
metadata = dataRow[6:]
child = cls(
@@ -692,7 +692,7 @@
if name == addressbook.name():
returnValue(addressbook)
- # all shared address books now
+ #all shared address books now
rows = None
queryCacher = home._txn._queryCacher
ownerHome = None
@@ -737,7 +737,7 @@
if not rows:
returnValue(None)
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage, ownerAddressBookID, cachedBindStatus = rows[0] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage, ownerAddressBookID, cachedBindStatus = rows[0] #@UnusedVariable
# if wrong status, exit here. Item is in queryCache
if (cachedBindStatus == _BIND_STATUS_ACCEPTED) != bool(accepted):
returnValue(None)
@@ -771,7 +771,7 @@
"""
bindRows = yield cls._bindForNameAndHomeID.on(home._txn, name=name, homeID=home._resourceID)
if bindRows:
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = bindRows[0] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = bindRows[0] #@UnusedVariable
if (bindStatus == _BIND_STATUS_ACCEPTED) != bool(accepted):
returnValue(None)
@@ -787,7 +787,7 @@
home._txn, name=name, homeID=home._resourceID
)
if groupBindRows:
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRows[0] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRows[0] #@UnusedVariable
if (bindStatus == _BIND_STATUS_ACCEPTED) != bool(accepted):
returnValue(None)
@@ -826,7 +826,7 @@
home._txn, resourceID=resourceID, homeID=home._resourceID
)
if bindRows:
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = bindRows[0] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = bindRows[0] #@UnusedVariable
if (bindStatus == _BIND_STATUS_ACCEPTED) != bool(accepted):
returnValue(None)
@@ -840,7 +840,7 @@
home._txn, homeID=home._resourceID, addressbookID=resourceID
)
if groupBindRows:
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRows[0] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRows[0] #@UnusedVariable
if (bindStatus == _BIND_STATUS_ACCEPTED) != bool(accepted):
returnValue(None)
@@ -881,7 +881,7 @@
rows.extend((yield AddressBookObject._acceptedBindForHomeID.on(
home._txn, homeID=home._resourceID
)))
- for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in rows: # @UnusedVariable
+ for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in rows: #@UnusedVariable
assert bindMode != _BIND_MODE_OWN
ownerHome = yield home._txn.homeWithResourceID(home._homeType, homeID)
names |= set([ownerHome.shareeAddressBookName()])
@@ -927,7 +927,7 @@
groupBindRows = yield AddressBookObject._unacceptedBindWithHomeIDAndAddressBookID.on(
self._txn, homeID=self._home._resourceID, addressbookID=self._resourceID
)
- # for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: #@UnusedVariable
+ #for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: #@UnusedVariable
returnValue([groupBindRow[2] for groupBindRow in groupBindRows])
@@ -939,7 +939,7 @@
groupBindRows = yield AddressBookObject._acceptedBindWithHomeIDAndAddressBookID.on(
self._txn, homeID=self._home._resourceID, addressbookID=self._resourceID
)
- # for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: #@UnusedVariable
+ #for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: #@UnusedVariable
returnValue([groupBindRow[2] for groupBindRow in groupBindRows])
@@ -953,7 +953,7 @@
)
readWriteGroupIDs = []
readOnlyGroupIDs = []
- for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: # @UnusedVariable
+ for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: #@UnusedVariable
if bindMode == _BIND_MODE_WRITE:
readWriteGroupIDs.append(resourceID)
else:
@@ -969,7 +969,7 @@
adjustedReadWriteGroupIDs = readWriteGroupIDs
returnValue((tuple(adjustedReadOnlyGroupIDs), tuple(adjustedReadWriteGroupIDs)))
- # FIXME: Unused
+ #FIXME: Unused
@inlineCallbacks
def readOnlyGroupIDs(self):
returnValue((yield self.accessControlGroupIDs())[0])
@@ -980,7 +980,7 @@
returnValue((yield self.accessControlGroupIDs())[1])
- # FIXME: Unused: Use for caching access
+ #FIXME: Unused: Use for caching access
@inlineCallbacks
def accessControlObjectIDs(self):
readOnlyIDs = set()
@@ -999,7 +999,7 @@
)
readWriteGroupIDs = []
readOnlyGroupIDs = []
- for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: # @UnusedVariable
+ for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: #@UnusedVariable
if bindMode == _BIND_MODE_WRITE:
readWriteGroupIDs.append(resourceID)
else:
@@ -1013,19 +1013,19 @@
returnValue(tuple(readOnlyIDs), tuple(readWriteIDs))
- # FIXME: Unused: Use for caching access
+ #FIXME: Unused: Use for caching access
@inlineCallbacks
def readOnlyObjectIDs(self):
returnValue((yield self.accessControlObjectIDs())[1])
- # FIXME: Unused: Use for caching access
+ #FIXME: Unused: Use for caching access
@inlineCallbacks
def readWriteObjectIDs(self):
returnValue((yield self.accessControlObjectIDs())[1])
- # FIXME: Unused: Use for caching access
+ #FIXME: Unused: Use for caching access
@inlineCallbacks
def allObjectIDs(self):
readOnlyIDs, readWriteIDs = yield self.accessControlObjectIDs()
@@ -1063,7 +1063,7 @@
# TODO: raise a nice exception if shareeView is not, in fact, a shared
# version of this same L{CommonHomeChild}
- # remove None parameters, and substitute None for empty string
+ #remove None parameters, and substitute None for empty string
bind = self._bindSchema
columnMap = dict([(k, v if v else None)
for k, v in {bind.BIND_MODE:mode,
@@ -1085,7 +1085,7 @@
resourceID=self._resourceID, homeID=shareeView._home._resourceID
)
- # update affected attributes
+ #update affected attributes
if mode is not None:
shareeView._bindMode = columnMap[bind.BIND_MODE]
@@ -1137,7 +1137,7 @@
bindRows = yield self._sharedBindForResourceID.on(
self._txn, resourceID=self._resourceID, homeID=self._home._resourceID
)
- for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in bindRows: # @UnusedVariable
+ for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in bindRows: #@UnusedVariable
home = yield self._txn.homeWithResourceID(self._home._homeType, homeID)
new = yield home.childWithName(self.shareeAddressBookName())
result.append(new)
@@ -1163,7 +1163,7 @@
bindRows = yield self._unacceptedBindForResourceID.on(
self._txn, resourceID=self._resourceID
)
- for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in bindRows: # @UnusedVariable
+ for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in bindRows: #@UnusedVariable
home = yield self._txn.homeWithResourceID(self._home._homeType, homeID)
new = yield self.objectWithName(home, self.shareeAddressBookName(), accepted=False)
result.append(new)
@@ -1196,7 +1196,7 @@
shareeHome._children.pop(self.sharedAddressBook.name(), None)
shareeHome._children.pop(self.sharedAddressBook._resourceID, None)
elif not sharedAddressBook.fullyShared():
- # FIXME: remove objects for this group only using self.removeObjectResource
+ #FIXME: remove objects for this group only using self.removeObjectResource
self._objectNames = None
# Must send notification to ensure cache invalidation occurs
@@ -1227,11 +1227,11 @@
_bindSchema = schema.GROUP_ADDRESSBOOK_HOME_BIND
# used by CommonHomeChild._childrenAndMetadataForHomeID() only
- # _homeChildSchema = schema.ADDRESSBOOK_OBJECT
- # _homeChildMetaDataSchema = schema.ADDRESSBOOK_OBJECT
+ #_homeChildSchema = schema.ADDRESSBOOK_OBJECT
+ #_homeChildMetaDataSchema = schema.ADDRESSBOOK_OBJECT
- def __init__(self, addressbook, name, uid, resourceID=None, metadata=None): # @UnusedVariable
+ def __init__(self, addressbook, name, uid, resourceID=None, metadata=None): #@UnusedVariable
self._kind = None
self._ownerAddressBookResourceID = None
@@ -1363,7 +1363,7 @@
@classproperty
- def _allColumnsWithResourceID(cls): # @NoSelf
+ def _allColumnsWithResourceID(cls): #@NoSelf
obj = cls._objectSchema
return Select(
cls._allColumns, From=obj,
@@ -1447,7 +1447,7 @@
)
if groupBindRows:
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRows[0] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRows[0] #@UnusedVariable
self._bindMode = bindMode
self._bindStatus = bindStatus
self._bindMessage = bindMessage
@@ -1461,7 +1461,7 @@
@classproperty
- def _allColumns(cls): # @NoSelf
+ def _allColumns(cls): #@NoSelf
"""
Full set of columns in the object table that need to be loaded to
initialize the object resource state.
@@ -1610,7 +1610,7 @@
@classproperty
- def _insertABObject(cls): # @NoSelf
+ def _insertABObject(cls): #@NoSelf
"""
DAL statement to create an addressbook object with all default values.
"""
@@ -1630,7 +1630,7 @@
@inlineCallbacks
- def updateDatabase(self, component, expand_until=None, reCreate=False, # @UnusedVariable
+ def updateDatabase(self, component, expand_until=None, reCreate=False, #@UnusedVariable
inserting=False):
"""
Update the database tables for the new data being written.
@@ -1676,9 +1676,9 @@
if not self.owned():
if not self._addressbook.fullyShared():
- # in shared ab defined by groups, all members must be inside the shared groups
+ #in shared ab defined by groups, all members must be inside the shared groups
- # FIXME: does this apply to whole-shared address books too?
+ #FIXME: does this apply to whole-shared address books too?
if foreignMemberAddrs:
raise GroupWithUnsharedAddressNotAllowedError
@@ -1771,7 +1771,7 @@
if self._kind == _ABO_KIND_GROUP:
- # get current members
+ #get current members
currentMemberRows = yield Select([aboMembers.MEMBER_ID],
From=aboMembers,
Where=aboMembers.GROUP_ID == self._resourceID,).on(self._txn)
@@ -1795,7 +1795,7 @@
# don't bother with aboForeignMembers on address books
if self._resourceID != self._ownerAddressBookResourceID:
- # get current foreign members
+ #get current foreign members
currentForeignMemberRows = yield Select(
[aboForeignMembers.MEMBER_ADDRESS],
From=aboForeignMembers,
@@ -1938,7 +1938,7 @@
# same as CommonHomeChild._childrenAndMetadataForHomeID() w/o metadata join
@classproperty
- def _childrenAndMetadataForHomeID(cls): # @NoSelf
+ def _childrenAndMetadataForHomeID(cls): #@NoSelf
bind = cls._bindSchema
child = cls._objectSchema
columns = cls._bindColumns() + cls.metadataColumns()
@@ -1974,7 +1974,7 @@
groupBindRows = yield self._sharedBindForResourceID.on(
self._txn, resourceID=self._resourceID, homeID=self._home._resourceID
)
- for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: # @UnusedVariable
+ for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: #@UnusedVariable
home = yield self._txn.homeWithResourceID(self._home._homeType, homeID)
addressbook = yield home.childWithName(self._home.shareeAddressBookName())
new = yield addressbook.objectResourceWithID(resourceID)
@@ -2002,7 +2002,7 @@
groupBindRows = yield self._unacceptedBindForResourceID.on(
self._txn, resourceID=self._resourceID
)
- for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: # @UnusedVariable
+ for bindMode, homeID, resourceID, bindName, bindStatus, bindMessage in groupBindRows: #@UnusedVariable
home = yield self._txn.homeWithResourceID(self._home._homeType, homeID)
addressbook = yield home.childWithName(self._home.shareeAddressBookName())
if not addressbook:
@@ -2014,7 +2014,7 @@
@classproperty
- def _addressbookIDForResourceID(cls): # @NoSelf
+ def _addressbookIDForResourceID(cls): #@NoSelf
obj = cls._objectSchema
return Select([obj.PARENT_RESOURCE_ID],
From=obj,
@@ -2138,7 +2138,7 @@
groupBindRows = yield self._bindForResourceIDAndHomeID.on(
self._txn, resourceID=self._resourceID, homeID=shareeHome._resourceID
)
- bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRows[0] # @UnusedVariable
+ bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRows[0] #@UnusedVariable
if bindStatus == _BIND_STATUS_ACCEPTED:
group = yield shareeHome.objectForShareUID(bindName)
else:
@@ -2154,7 +2154,7 @@
returnValue(bindName)
@inlineCallbacks
- # TODO: This is almost the same as AddressBook.updateShare(): combine
+ #TODO: This is almost the same as AddressBook.updateShare(): combine
def updateShare(self, shareeView, mode=None, status=None, message=None, name=None):
"""
Update share mode, status, and message for a home child shared with
@@ -2186,7 +2186,7 @@
# version of this same L{CommonHomeChild}
- # remove None parameters, and substitute None for empty string
+ #remove None parameters, and substitute None for empty string
bind = self._bindSchema
columnMap = dict([(k, v if v else None)
for k, v in {bind.BIND_MODE:mode,
@@ -2210,7 +2210,7 @@
resourceID=self._resourceID, homeID=shareeView._home._resourceID
)
- # update affected attributes
+ #update affected attributes
if mode is not None:
shareeView._bindMode = columnMap[bind.BIND_MODE]
@@ -2245,7 +2245,7 @@
@classproperty
- def _acceptedBindWithHomeIDAndAddressBookID(cls): # @NoSelf
+ def _acceptedBindWithHomeIDAndAddressBookID(cls): #@NoSelf
bind = cls._bindSchema
abo = cls._objectSchema
return Select(
@@ -2259,7 +2259,7 @@
@classproperty
- def _unacceptedBindWithHomeIDAndAddressBookID(cls): # @NoSelf
+ def _unacceptedBindWithHomeIDAndAddressBookID(cls): #@NoSelf
bind = cls._bindSchema
abo = cls._objectSchema
return Select(
@@ -2273,7 +2273,7 @@
@classproperty
- def _bindWithHomeIDAndAddressBookID(cls): # @NoSelf
+ def _bindWithHomeIDAndAddressBookID(cls): #@NoSelf
bind = cls._bindSchema
abo = cls._objectSchema
return Select(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130319/2c431311/attachment-0001.html>
More information about the calendarserver-changes
mailing list