[CalendarServer-changes] [11232] CalendarServer/trunk/txdav

source_changes at macosforge.org source_changes at macosforge.org
Tue May 21 10:48:17 PDT 2013


Revision: 11232
          http://trac.calendarserver.org//changeset/11232
Author:   cdaboo at apple.com
Date:     2013-05-21 10:48:17 -0700 (Tue, 21 May 2013)
Log Message:
-----------
Fix sync report for shared address books (shared groups needs more work).

Modified Paths:
--------------
    CalendarServer/trunk/txdav/carddav/datastore/sql.py
    CalendarServer/trunk/txdav/common/datastore/sql.py

Modified: CalendarServer/trunk/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/sql.py	2013-05-21 17:47:34 UTC (rev 11231)
+++ CalendarServer/trunk/txdav/carddav/datastore/sql.py	2013-05-21 17:48:17 UTC (rev 11232)
@@ -316,8 +316,7 @@
              rev.DELETED],
             From=rev,
             Where=(rev.REVISION > Parameter("revision")).And(
-                rev.HOME_RESOURCE_ID == Parameter("resourceID")).And(
-                rev.RESOURCE_ID == rev.HOME_RESOURCE_ID)
+                rev.HOME_RESOURCE_ID == Parameter("resourceID"))
         )
 
 
@@ -328,8 +327,10 @@
                                          resourceID=self._resourceID,
                                          revision=revision)
 
-        bindName = self.addressbook().name()
-        result = [[bindName] + row for row in rows]
+        # If the collection name is None that means we have a change to the owner's default address book,
+        # so substitute in the name of that. If collection name is not None, then we have a revision
+        # for the owned or a shared address book itself.
+        result = [[row[0] if row[0] is not None else self.addressbook().name()] + row for row in rows]
         returnValue(result)
 
 

Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py	2013-05-21 17:47:34 UTC (rev 11231)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py	2013-05-21 17:48:17 UTC (rev 11232)
@@ -1942,18 +1942,11 @@
 
         # Now deal with shared collections
         # TODO: think about whether this can be done in one query rather than looping over each share
-        bind = self._bindSchema
         rev = self._revisionsSchema
         shares = yield self.children()
         for share in shares:
             if not share.owned():
                 sharerevision = 0 if revision < share._bindRevision else revision
-                shareID = (yield Select(
-                    [bind.RESOURCE_ID], From=bind,
-                    Where=(bind.RESOURCE_NAME == share.shareUID()).And(
-                        bind.HOME_RESOURCE_ID == self._resourceID).And(
-                            bind.BIND_MODE != _BIND_MODE_OWN)
-                ).on(self._txn))[0][0]
                 results = [
                     (
                         share.name(),
@@ -1964,7 +1957,7 @@
                     (yield Select([rev.RESOURCE_NAME, rev.DELETED],
                                      From=rev,
                                     Where=(rev.REVISION > sharerevision).And(
-                                    rev.RESOURCE_ID == shareID)).on(self._txn))
+                                    rev.RESOURCE_ID == share._resourceID)).on(self._txn))
                     if name
                 ]
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130521/f0fb108a/attachment.html>


More information about the calendarserver-changes mailing list