[CalendarServer-changes] [11130] CalendarServer/branches/users/gaya/sharedgroups-3
source_changes at macosforge.org
source_changes at macosforge.org
Fri May 3 14:01:10 PDT 2013
Revision: 11130
http://trac.calendarserver.org//changeset/11130
Author: gaya at apple.com
Date: 2013-05-03 14:01:10 -0700 (Fri, 03 May 2013)
Log Message:
-----------
ADDRESSBOOK_HOME.PROPERTY_STORE_ID -> ADDRESSBOOK_HOME -> ADDRESSBOOK_PROPERTY_STORE_ID; fix upgrade to drop tables (not delete)
Modified Paths:
--------------
CalendarServer/branches/users/gaya/sharedgroups-3/calendarserver/tap/caldav.py
CalendarServer/branches/users/gaya/sharedgroups-3/txdav/carddav/datastore/sql.py
CalendarServer/branches/users/gaya/sharedgroups-3/txdav/carddav/datastore/test/test_sql.py
CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/current-oracle-dialect.sql
CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/current.sql
CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_18_to_19.sql
CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/upgrade/sql/upgrade.py
Modified: CalendarServer/branches/users/gaya/sharedgroups-3/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups-3/calendarserver/tap/caldav.py 2013-05-03 20:49:08 UTC (rev 11129)
+++ CalendarServer/branches/users/gaya/sharedgroups-3/calendarserver/tap/caldav.py 2013-05-03 21:01:10 UTC (rev 11130)
@@ -66,7 +66,7 @@
from txdav.common.datastore.sql_tables import schema
from txdav.common.datastore.upgrade.sql.upgrade import (
- UpgradeDatabaseSchemaStep, UpgradeDatabaseAddressBookDataStep,
+ UpgradeDatabaseSchemaStep, UpgradeDatabaseAddressBookDataStep,
UpgradeDatabaseCalendarDataStep, UpgradeDatabaseOtherStep,
)
from txdav.common.datastore.upgrade.migrate import UpgradeToDatabaseStep
@@ -255,7 +255,7 @@
connectionServiceName = "ConnectionService"
def __init__(self, logObserver):
- self.logObserver = logObserver # accesslog observer
+ self.logObserver = logObserver # accesslog observer
MultiService.__init__(self)
@@ -569,7 +569,7 @@
self.connectionPool = connectionPool
self.store = store
self.logObserver = logObserver
- self.stepper = Stepper()
+ self.stepper = Stepper()
if reactor is None:
from twisted.internet import reactor
@@ -985,7 +985,7 @@
requestFactory, int(config.MetaFD), contextFactory
).setServiceParent(connectionService)
- else: # Not inheriting, therefore we open our own:
+ else: # Not inheriting, therefore we open our own:
for bindAddress in self._allBindAddresses():
self._validatePortConfig()
if config.EnableSSL:
@@ -1101,7 +1101,7 @@
pushDistributor = PushDistributor(observers)
directory = result.rootResource.getDirectory()
-
+
# Optionally set up mail retrieval
if config.Scheduling.iMIP.Enabled:
mailRetriever = MailRetriever(store, directory,
@@ -1131,7 +1131,7 @@
store.callWithNewTransactions(decorateTransaction)
- return result
+ return result
uid, gid = getSystemIDs(config.UserName, config.GroupName)
@@ -1242,13 +1242,11 @@
failIfUpgradeNeeded=config.FailIfUpgradeNeeded
)
)
- '''
pps.addStep(
UpgradeDatabaseAddressBookDataStep(
store, uid=overrideUID, gid=overrideGID
)
)
- '''
pps.addStep(
UpgradeDatabaseCalendarDataStep(
store, uid=overrideUID, gid=overrideGID
@@ -1293,7 +1291,7 @@
if config.UseDatabase:
- if os.getuid() == 0: # Only override if root
+ if os.getuid() == 0: # Only override if root
overrideUID = uid
overrideGID = gid
else:
@@ -1428,7 +1426,7 @@
config.MultiProcess.ProcessCount))
dispatcher = cl.dispatcher
else:
- s._inheritedSockets = [] # keep a reference to these so they don't close
+ s._inheritedSockets = [] # keep a reference to these so they don't close
dispatcher = None
for bindAddress in self._allBindAddresses():
@@ -2075,7 +2073,7 @@
MAX_LENGTH = 1024
CONTINUED_TEXT = " (truncated, continued)"
tag = None
- exceeded = False # Am I in the middle of parsing a long line?
+ exceeded = False # Am I in the middle of parsing a long line?
_buffer = ''
def makeConnection(self, transport):
@@ -2134,7 +2132,7 @@
segments = []
for i in range(numSegments):
msg = line[i * self.MAX_LENGTH:(i + 1) * self.MAX_LENGTH]
- if i < numSegments - 1: # not the last segment
+ if i < numSegments - 1: # not the last segment
msg += self.CONTINUED_TEXT
segments.append(msg)
return segments
Modified: CalendarServer/branches/users/gaya/sharedgroups-3/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups-3/txdav/carddav/datastore/sql.py 2013-05-03 20:49:08 UTC (rev 11129)
+++ CalendarServer/branches/users/gaya/sharedgroups-3/txdav/carddav/datastore/sql.py 2013-05-03 21:01:10 UTC (rev 11130)
@@ -82,7 +82,7 @@
self._childClass = AddressBook
super(AddressBookHome, self).__init__(transaction, ownerUID, notifiers)
- self._homePropertyStoreID = None
+ self._addressbookPropertyStoreID = None
self._addressbook = None
@@ -99,9 +99,9 @@
@classproperty
- def _resourceIDAndHomeResourceIDFromOwnerQuery(cls): #@NoSelf
+ def _resourceIDAndHomeResourceIDFromOwnerQuery(cls): #@NoSelf
home = cls._homeSchema
- return Select([home.RESOURCE_ID, home.PROPERTY_STORE_ID],
+ return Select([home.RESOURCE_ID, home.ADDRESSBOOK_PROPERTY_STORE_ID],
From=home, Where=home.OWNER_UID == Parameter("ownerUID"))
@@ -120,7 +120,7 @@
yield self._cacher.set(self._ownerUID, result)
if result:
- self._resourceID, self._homePropertyStoreID = result[0]
+ self._resourceID, self._addressbookPropertyStoreID = result[0]
queryCacher = self._txn._queryCacher
if queryCacher:
@@ -156,18 +156,6 @@
@inlineCallbacks
- def _loadPropertyStore(self):
- props = yield PropertyStore.load(
- self.uid(),
- self.uid(),
- self._txn,
- self._homePropertyStoreID, # not ._resourceID as in CommonHome._loadPropertyStore()
- notifyCallback=self.notifyChanged
- )
- self._propertyStore = props
-
-
- @inlineCallbacks
def remove(self):
ah = schema.ADDRESSBOOK_HOME
ahb = schema.SHARED_ADDRESSBOOK_BIND
@@ -192,7 +180,7 @@
yield Delete(
From=rp,
Where=(rp.RESOURCE_ID == self._resourceID).Or(
- rp.RESOURCE_ID == self._homePropertyStoreID
+ rp.RESOURCE_ID == self._addressbookPropertyStoreID
)
).on(self._txn)
@@ -274,7 +262,7 @@
@classproperty
- def _syncTokenQuery(cls): #@NoSelf
+ def _syncTokenQuery(cls): #@NoSelf
"""
DAL Select statement to find the sync token.
"""
@@ -318,7 +306,7 @@
@classproperty
- def _changesQuery(cls): #@NoSelf
+ def _changesQuery(cls): #@NoSelf
rev = cls._revisionsSchema
return Select(
[rev.RESOURCE_NAME, rev.DELETED],
@@ -407,7 +395,7 @@
def resourceType(self):
- return ResourceType.addressbook #@UndefinedVariable
+ return ResourceType.addressbook #@UndefinedVariable
#FIXME: Only used for shared group resouretype in SharedResourceMixin.upgradeToShare() and SharedResourceMixin.downgradeFromShare()
@@ -431,6 +419,19 @@
return self._home.shareeAddressBookName()
+ @inlineCallbacks
+ def _loadPropertyStore(self, props=None):
+ if props is None:
+ props = yield PropertyStore.load(
+ self.ownerHome().uid(),
+ self.viewerHome().uid(),
+ self._txn,
+ self.ownerHome()._addressbookPropertyStoreID, # not ._resourceID as in CommonHomeChild._loadPropertyStore()
+ notifyCallback=self.notifyChanged
+ )
+ super(AddressBook, self)._loadPropertyStore(props)
+
+
def initPropertyStore(self, props):
# Setup peruser special properties
props.setSpecialProperties(
@@ -468,7 +469,7 @@
for abo in (yield self.objectResources()):
yield self.removeObjectResource(abo)
- yield self.unshare() # storebridge should already have done this
+ yield self.unshare() # storebridge should already have done this
# don't delete. Note that revision table is NOT queried for removes
# yield self._deletedSyncToken()
@@ -558,17 +559,17 @@
Where=obj.ADDRESSBOOK_HOME_RESOURCE_ID == Parameter("addressbookResourceID"),)
- def _fullySharedAddressBookGroupRow(self): #@NoSelf
+ def _fullySharedAddressBookGroupRow(self): #@NoSelf
return [
self._resourceID, # obj.ADDRESSBOOK_HOME_RESOURCE_ID,
- self._resourceID, # obj.RESOURCE_ID,
- self._fullySharedAddressBookGroupName(), # obj.RESOURCE_NAME, shared name is UID and thus avoids collisions
- self._fullySharedAddressBookGroupUID(), # obj.UID, shared name is uuid
- _ABO_KIND_GROUP, # obj.KIND,
- "1", # obj.MD5, unused
- "1", # Len(obj.TEXT), unused
- self._created, # obj.CREATED,
- self._modified, # obj.CREATED,
+ self._resourceID, # obj.RESOURCE_ID,
+ self._fullySharedAddressBookGroupName(), # obj.RESOURCE_NAME, shared name is UID and thus avoids collisions
+ self._fullySharedAddressBookGroupUID(), # obj.UID, shared name is uuid
+ _ABO_KIND_GROUP, # obj.KIND,
+ "1", # obj.MD5, unused
+ "1", # Len(obj.TEXT), unused
+ self._created, # obj.CREATED,
+ self._modified, # obj.CREATED,
]
@@ -651,7 +652,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
@@ -661,28 +662,29 @@
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:
groupBindRow[0] = _BIND_MODE_WRITE
- groupBindRow[3] = None # bindName
- groupBindRow[4] = None # bindStatus
- groupBindRow[5] = None # bindMessage
+ groupBindRow[3] = None # bindName
+ groupBindRow[4] = None # bindStatus
+ groupBindRow[5] = None # bindMessage
ownerHomeToDataRowMap[ownerHome] = groupBindRow
if ownerHomeToDataRowMap:
# Get property stores for all these child resources (if any found)
- childResourceIDs = [ownerHome._resourceID for ownerHome in ownerHomeToDataRowMap]
+ addressbookPropertyStoreIDs = [ownerHome._addressbookPropertyStoreID for ownerHome in ownerHomeToDataRowMap]
propertyStores = yield PropertyStore.forMultipleResourcesWithResourceIDs(
- home.uid(), home._txn, childResourceIDs
+ home.uid(), home._txn, addressbookPropertyStoreIDs
)
- revisions = yield cls._revisionsForResourceIDs(childResourceIDs).on(home._txn, resourceIDs=childResourceIDs)
+ addressbookResourceIDs = [ownerHome._resourceID for ownerHome in ownerHomeToDataRowMap]
+ revisions = yield cls._revisionsForResourceIDs(addressbookPropertyStoreIDs).on(home._txn, resourceIDs=addressbookResourceIDs)
revisions = dict(revisions)
# 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(
@@ -697,7 +699,7 @@
for attr, value in zip(cls.metadataAttributes(), metadata):
setattr(child, attr, value)
child._syncTokenRevision = revisions[child._resourceID]
- propstore = propertyStores.get(child._resourceID, None)
+ propstore = propertyStores.get(ownerHome._addressbookPropertyStoreID, None)
# We have to re-adjust the property store object to account for possible shared
# collections as previously we loaded them all as if they were owned
propstore._setDefaultUserUID(ownerHome.uid())
@@ -746,18 +748,18 @@
)
if rows:
rows[0].append(ownerAddressBook._resourceID)
- rows[0].append(rows[0][4]) # cachedStatus = bindStatus
+ rows[0].append(rows[0][4]) # cachedStatus = bindStatus
else:
groupBindRows = yield AddressBookObject._bindWithHomeIDAndAddressBookID.on(
home._txn, homeID=home._resourceID, addressbookID=ownerAddressBook._resourceID
)
if groupBindRows:
groupBindRow = groupBindRows[0]
- cachedBindStatus = groupBindRow[4] # save off bindStatus
+ cachedBindStatus = groupBindRow[4] # save off bindStatus
groupBindRow[0] = _BIND_MODE_WRITE
- groupBindRow[3] = None # bindName
- groupBindRow[4] = None # bindStatus
- groupBindRow[5] = None # bindMessage
+ groupBindRow[3] = None # bindName
+ groupBindRow[4] = None # bindStatus
+ groupBindRow[5] = None # bindMessage
groupBindRow.append(ownerAddressBook._resourceID)
groupBindRow.append(cachedBindStatus)
rows = [groupBindRow]
@@ -769,7 +771,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)
@@ -803,7 +805,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)
@@ -819,7 +821,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)
@@ -834,7 +836,7 @@
if accepted:
returnValue((yield addressbook.objectResourceWithID(resourceID)))
else:
- returnValue((yield AddressBookObject.objectWithID(addressbook, resourceID))) # avoids object cache
+ returnValue((yield AddressBookObject.objectWithID(addressbook, resourceID))) # avoids object cache
returnValue(None)
@@ -858,7 +860,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)
@@ -872,7 +874,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)
@@ -913,7 +915,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
ownerHome = yield home._txn.homeWithResourceID(home._homeType, homeID)
names |= set([ownerHome.shareeAddressBookName()])
returnValue(tuple(names))
@@ -984,7 +986,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:
@@ -1030,7 +1032,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:
@@ -1168,7 +1170,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)
@@ -1194,7 +1196,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)
@@ -1262,7 +1264,7 @@
#_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
@@ -1343,7 +1345,7 @@
# add to foreign member table row by UID
memberAddress = "urn:uuid:" + self._uid
for groupID in [groupIDRow[0] for groupIDRow in groupIDRows]:
- if groupID != self._ownerAddressBookResourceID: # no aboForeignMembers on address books
+ if groupID != self._ownerAddressBookResourceID: # no aboForeignMembers on address books
yield Insert(
{aboForeignMembers.GROUP_ID: groupID,
aboForeignMembers.ADDRESSBOOK_ID: self._ownerAddressBookResourceID,
@@ -1397,7 +1399,7 @@
@classproperty
- def _allColumnsWithResourceID(cls): #@NoSelf
+ def _allColumnsWithResourceID(cls): #@NoSelf
obj = cls._objectSchema
return Select(
cls._allColumns, From=obj,
@@ -1415,7 +1417,7 @@
@return: L{self} if object exists in the DB, else C{None}
"""
rows = None
- if self.owned() or self._addressbook.fullyShared(): # owned or fully shared
+ if self.owned() or self._addressbook.fullyShared(): # owned or fully shared
if self._name:
rows = yield self._allColumnsWithParentAndName.on(
self._txn, name=self._name,
@@ -1432,7 +1434,7 @@
parentID=self._parentCollection._resourceID
)
- if not rows and self._addressbook.fullyShared(): # perhaps add special group
+ if not rows and self._addressbook.fullyShared(): # perhaps add special group
if self._name:
if self._name == self._addressbook._fullySharedAddressBookGroupName():
rows = [self._addressbook._fullySharedAddressBookGroupRow()]
@@ -1481,7 +1483,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
@@ -1495,7 +1497,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.
@@ -1600,7 +1602,7 @@
if self.owned():
# update revision table of the sharee group address book
- if self._kind == _ABO_KIND_GROUP: # optimization
+ if self._kind == _ABO_KIND_GROUP: # optimization
for shareeAddressBook in (yield self.asShared()):
yield self._changeAddressBookRevision(shareeAddressBook, inserting)
# one is enough because all have the same resourceID
@@ -1643,7 +1645,7 @@
@classproperty
- def _insertABObject(cls): #@NoSelf
+ def _insertABObject(cls): #@NoSelf
"""
DAL statement to create an addressbook object with all default values.
"""
@@ -1663,7 +1665,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.
@@ -1680,7 +1682,7 @@
}
lcResourceKind = component.resourceKind().lower() if component.resourceKind() else component.resourceKind();
kind = componentResourceKindToAddressBookObjectKindMap.get(lcResourceKind, _ABO_KIND_PERSON)
- assert inserting or self._kind == kind # can't change kind. Should be checked in upper layers
+ assert inserting or self._kind == kind # can't change kind. Should be checked in upper layers
self._kind = kind
# For shared groups: Non owner may NOT add group members not currently in group!
@@ -1744,7 +1746,7 @@
self._objectText = componentText
uid = component.resourceUID()
- assert inserting or self._uid == uid # can't change UID. Should be checked in upper layers
+ assert inserting or self._uid == uid # can't change UID. Should be checked in upper layers
self._uid = uid
# Special - if migrating we need to preserve the original md5
@@ -1970,7 +1972,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()
@@ -2006,7 +2008,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)
@@ -2034,19 +2036,19 @@
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:
addressbook = yield AddressBook.objectWithName(home, self._home.shareeAddressBookName(), accepted=False)
- new = yield AddressBookObject.objectWithID(addressbook, resourceID) # avoids object cache
+ new = yield AddressBookObject.objectWithID(addressbook, resourceID) # avoids object cache
result.append(new)
returnValue(result)
@classproperty
- def _addressbookIDForResourceID(cls): #@NoSelf
+ def _addressbookIDForResourceID(cls): #@NoSelf
obj = cls._objectSchema
return Select([obj.PARENT_RESOURCE_ID],
From=obj,
@@ -2170,7 +2172,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:
@@ -2277,7 +2279,7 @@
@classproperty
- def _acceptedBindWithHomeIDAndAddressBookID(cls): #@NoSelf
+ def _acceptedBindWithHomeIDAndAddressBookID(cls): #@NoSelf
bind = cls._bindSchema
abo = cls._objectSchema
return Select(
@@ -2291,7 +2293,7 @@
@classproperty
- def _unacceptedBindWithHomeIDAndAddressBookID(cls): #@NoSelf
+ def _unacceptedBindWithHomeIDAndAddressBookID(cls): #@NoSelf
bind = cls._bindSchema
abo = cls._objectSchema
return Select(
@@ -2305,7 +2307,7 @@
@classproperty
- def _bindWithHomeIDAndAddressBookID(cls): #@NoSelf
+ def _bindWithHomeIDAndAddressBookID(cls): #@NoSelf
bind = cls._bindSchema
abo = cls._objectSchema
return Select(
Modified: CalendarServer/branches/users/gaya/sharedgroups-3/txdav/carddav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups-3/txdav/carddav/datastore/test/test_sql.py 2013-05-03 20:49:08 UTC (rev 11129)
+++ CalendarServer/branches/users/gaya/sharedgroups-3/txdav/carddav/datastore/test/test_sql.py 2013-05-03 21:01:10 UTC (rev 11130)
@@ -538,7 +538,7 @@
home = yield self.homeUnderTest()
name = "addressbook"
addressbook = yield home.createAddressBookWithName(name)
- resourceID = addressbook._resourceID
+ resourceID = home._addressbookPropertyStoreID
rows = yield _allWithID.on(self.transactionUnderTest(), resourceID=resourceID)
self.assertEqual(len(tuple(rows)), 1)
Modified: CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/current-oracle-dialect.sql
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/current-oracle-dialect.sql 2013-05-03 20:49:08 UTC (rev 11129)
+++ CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/current-oracle-dialect.sql 2013-05-03 21:01:10 UTC (rev 11130)
@@ -183,7 +183,7 @@
create table ADDRESSBOOK_HOME (
"RESOURCE_ID" integer primary key,
- "PROPERTY_STORE_ID" integer not null,
+ "ADDRESSBOOK_PROPERTY_STORE_ID" integer not null,
"OWNER_UID" nvarchar2(255) unique,
"DATAVERSION" integer default 0 not null
);
Modified: CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/current.sql
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/current.sql 2013-05-03 20:49:08 UTC (rev 11129)
+++ CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/current.sql 2013-05-03 21:01:10 UTC (rev 11130)
@@ -341,10 +341,10 @@
----------------------
create table ADDRESSBOOK_HOME (
- RESOURCE_ID integer primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
- PROPERTY_STORE_ID integer default nextval('RESOURCE_ID_SEQ') not null, -- implicit index
- OWNER_UID varchar(255) not null unique, -- implicit index
- DATAVERSION integer default 0 not null
+ RESOURCE_ID integer primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
+ ADDRESSBOOK_PROPERTY_STORE_ID integer default nextval('RESOURCE_ID_SEQ') not null, -- implicit index
+ OWNER_UID varchar(255) not null unique, -- implicit index
+ DATAVERSION integer default 0 not null
);
Modified: CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_18_to_19.sql
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_18_to_19.sql 2013-05-03 20:49:08 UTC (rev 11129)
+++ CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_18_to_19.sql 2013-05-03 21:01:10 UTC (rev 11130)
@@ -111,11 +111,9 @@
--------------------
alter table ADDRESSBOOK_HOME
- add column PROPERTY_STORE_ID integer default nextval('RESOURCE_ID_SEQ') not null;
+ add column ADDRESSBOOK_PROPERTY_STORE_ID integer default nextval('RESOURCE_ID_SEQ') not null;
-
-
------------------
-- TODO: Finish --
------------------
@@ -125,9 +123,9 @@
-- delete unused tables --
--------------------------
-delete table ADDRESSBOOK;
-delete table ADDRESSBOOK_METADATA;
-delete table ADDRESSBOOK_BIND;
+drop table ADDRESSBOOK_METADATA;
+drop table ADDRESSBOOK_BIND;
+drop table ADDRESSBOOK;
-- not needed:
-- drop index ADDRESSBOOK_BIND_RESOURCE_ID;
Modified: CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/upgrade/sql/upgrade.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/upgrade/sql/upgrade.py 2013-05-03 20:49:08 UTC (rev 11129)
+++ CalendarServer/branches/users/gaya/sharedgroups-3/txdav/common/datastore/upgrade/sql/upgrade.py 2013-05-03 21:01:10 UTC (rev 11130)
@@ -24,7 +24,6 @@
from twext.python.log import LoggingMixIn
-from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.python.modules import getModule
from twisted.python.reflect import namedObject
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130503/cb30f326/attachment-0001.html>
More information about the calendarserver-changes
mailing list