[CalendarServer-changes] [10881] CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/ datastore
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 8 19:02:47 PST 2013
Revision: 10881
http://trac.calendarserver.org//changeset/10881
Author: gaya at apple.com
Date: 2013-03-08 19:02:47 -0800 (Fri, 08 Mar 2013)
Log Message:
-----------
fix ab home sync token
Modified Paths:
--------------
CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/common.py
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py 2013-03-09 03:02:20 UTC (rev 10880)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py 2013-03-09 03:02:47 UTC (rev 10881)
@@ -142,9 +142,6 @@
)
self._created, self._modified = data
yield addressbook._loadPropertyStore()
- addressbook.properties()[
- PropertyName.fromElement(ResourceType)
- ] = addressbook.resourceType()
self._addressbook = addressbook
returnValue(self)
@@ -196,7 +193,7 @@
@inlineCallbacks
def createdHome(self):
- # initialize address book properties, synctoken
+ # initialize synctoken
yield self.addressbook()._initSyncToken()
@@ -256,7 +253,50 @@
ownerHome = yield self._txn.homeWithResourceID(self._homeType, resourceID)
returnValue(ownerHome)
+ @classproperty
+ def _syncTokenQuery(cls): #@NoSelf
+ """
+ DAL Select statement to find the sync token.
+ """
+ rev = cls._revisionsSchema
+ bind = cls._bindSchema
+ return Select(
+ [Max(rev.REVISION)],
+ # active address books
+ From=Select(
+ [rev.REVISION],
+ From=rev,
+ Where=(
+ rev.RESOURCE_ID.In(
+ Select(
+ [bind.RESOURCE_ID],
+ From=bind,
+ Where=bind.HOME_RESOURCE_ID == Parameter("resourceID"),
+ )
+ )
+ ),
+ SetExpression=Union(
+ # deleted address books
+ Select(
+ [rev.REVISION],
+ From=rev,
+ Where=(rev.HOME_RESOURCE_ID == Parameter("resourceID")).And(rev.RESOURCE_ID == None),
+ SetExpression=Union(
+ # owned address book
+ Select(
+ [rev.REVISION],
+ From=rev,
+ Where=(rev.HOME_RESOURCE_ID == Parameter("resourceID")).And(rev.RESOURCE_ID == rev.HOME_RESOURCE_ID),
+ ),
+ optype=Union.OPTYPE_ALL,
+ )
+ ),
+ optype=Union.OPTYPE_ALL,
+ )
+ ),
+ )
+
AddressBookHome._register(EADDRESSBOOKTYPE)
@@ -367,8 +407,11 @@
yield self.removeObjectResource(abo)
yield self.unshare() # storebridge should already have done this
- yield self._deletedSyncToken()
+ # don't delete, as that will keep showing the same home synctoken/etag
+ #yield self._deletedSyncToken()
+ yield self._updateRevision(self.name())
+
self.properties()._removeResource()
yield self._loadPropertyStore()
self.properties()[
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/common.py 2013-03-09 03:02:20 UTC (rev 10880)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/common.py 2013-03-09 03:02:47 UTC (rev 10881)
@@ -294,7 +294,7 @@
home = yield self.homeUnderTest()
name = "addressbook"
#self.assertIdentical((yield home.addressbookWithName(name)), None)
- yield home.createAddressBookWithName(name)
+ yield home.removeAddressBookWithName(name)
self.assertNotIdentical((yield home.addressbookWithName(name)), None)
@inlineCallbacks
def checkProperties():
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130308/26a6985c/attachment-0001.html>
More information about the calendarserver-changes
mailing list