[CalendarServer-changes] [10713] CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/ datastore/sql.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 13 12:22:23 PST 2013


Revision: 10713
          http://trac.calendarserver.org//changeset/10713
Author:   gaya at apple.com
Date:     2013-02-13 12:22:23 -0800 (Wed, 13 Feb 2013)
Log Message:
-----------
objectWithBindName uses childWithName() instead of childWithID()

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-02-13 19:49:34 UTC (rev 10712)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py	2013-02-13 20:22:23 UTC (rev 10713)
@@ -622,18 +622,25 @@
         bindRows = yield cls._acceptedBindForNameAndHomeID.on(home._txn, name=bindName, homeID=home._resourceID)
         if bindRows:
             bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = bindRows[0] #@UnusedVariable
-            #TODO: use childWithName, since it is cached by querycacher
-            returnValue((yield home.childWithID(resourceID)))
+            # use childWithName, since it is cached by querycacher
+            # returnValue((yield home.childWithID(resourceID)))
+            ownerHomeID = yield cls.ownerHomeID(home._txn, resourceID)
+            ownerHome = yield home._txn.homeWithResourceID(home._homeType, ownerHomeID)
+            ownerAddressBook = yield ownerHome.addressbook()
+            returnValue((yield home.childWithName(ownerAddressBook.shareeABName())))
 
+
         groupBindRows = yield AddressBookObject._acceptedBindForNameAndHomeID.on(home._txn, name=bindName, homeID=home._resourceID)
         if groupBindRows:
             bindMode, homeID, resourceID, bindName, bindStatus, bindMessage = groupBindRows[0] #@UnusedVariable
             ownerAddressBookIDRows = yield AddressBookObject._parentIDForObjectID.on(home._txn, objectID=resourceID)
-            #TODO: use childWithName, since it is cached by querycacher
-            sharedAB = yield cls.objectWithID(home, ownerAddressBookIDRows[0][0])
-            #sharedAB = yield home.childWithID(ownerAddressBookIDRows[0][0])
-            result = yield sharedAB.objectResourceWithID(resourceID)
-            returnValue(result)
+            # use childWithName, since it is cached by querycacher
+            # addressbook = yield cls.objectWithID(home, ownerAddressBookIDRows[0][0])
+            ownerHomeID = yield cls.ownerHomeID(home._txn, ownerAddressBookIDRows[0][0])
+            ownerHome = yield home._txn.homeWithResourceID(home._homeType, ownerHomeID)
+            ownerAddressBook = yield ownerHome.addressbook()
+            addressbook = yield home.childWithName(ownerAddressBook.shareeABName())
+            returnValue((yield addressbook.objectResourceWithID(resourceID)))
 
         returnValue(None)
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130213/59ad2901/attachment.html>


More information about the calendarserver-changes mailing list