[CalendarServer-changes] [9411] CalendarServer/branches/users/gaya/inviteclean/txdav

source_changes at macosforge.org source_changes at macosforge.org
Fri Jul 6 17:54:34 PDT 2012


Revision: 9411
          http://trac.macosforge.org/projects/calendarserver/changeset/9411
Author:   gaya at apple.com
Date:     2012-07-06 17:54:34 -0700 (Fri, 06 Jul 2012)
Log Message:
-----------
shareWith() now adds a valid INVITE table row RECIPIENT_ADDRESS col

Modified Paths:
--------------
    CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/common.py
    CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py

Modified: CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/common.py	2012-07-06 19:55:01 UTC (rev 9410)
+++ CalendarServer/branches/users/gaya/inviteclean/txdav/caldav/datastore/test/common.py	2012-07-07 00:54:34 UTC (rev 9411)
@@ -993,6 +993,12 @@
         other = yield self.homeUnderTest(name=OTHER_HOME_UID)
         newCalName = yield cal.shareWith(other, _BIND_MODE_WRITE)
         self.sharedName = newCalName
+        # Use the legacy invite record to check INVITE table, RECIPIENT_ADDRESS (for now)
+        self.assertEqual(
+            [record.userid for record in
+             (yield cal.retrieveOldInvites().allRecords())],
+            ["urn:uuid:"+OTHER_HOME_UID,]
+        )        
         yield self.commit()
         normalCal = yield self.calendarUnderTest()
         otherHome = yield self.homeUnderTest(name=OTHER_HOME_UID)

Modified: CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py	2012-07-06 19:55:01 UTC (rev 9410)
+++ CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py	2012-07-07 00:54:34 UTC (rev 9411)
@@ -2059,7 +2059,7 @@
 
 
     @inlineCallbacks
-    def shareWith(self, shareeHome, mode):
+    def shareWith(self, shareeHome, mode, bindStatus=None, recipient=None):
         """
         Share this (owned) L{CommonHomeChild} with another home.
 
@@ -2070,13 +2070,21 @@
             L{_BIND_MODE_WRITE}.
         @type mode: L{str}
 
+        @param recipient: The sharing recipient if not "urn:uuid:" + shareeHome.uid()
+        @type recipient: L{str}
+
         @return: the name of the shared calendar in the new calendar home.
         @rtype: L{str}
         """
+        
+        # recipient is needed for current legacy invites
+        if recipient is None:
+            recipient = "urn:uuid:" + shareeHome.uid()
+
         dn = PropertyName.fromElement(DisplayName)
         dnprop = (self.properties().get(dn) or
                   DisplayName.fromString(self.name()))
-        # FIXME: honor current home type
+
         @inlineCallbacks
         def doInsert(subt):
             newName = str(uuid4())
@@ -2089,7 +2097,7 @@
             yield self._insertInviteQuery.on(
                 subt, uid=newName, name=str(dnprop),
                 homeID=shareeHome._resourceID, resourceID=self._resourceID,
-                recipient=shareeHome.uid()
+                recipient=recipient
             )
             returnValue(newName)
         try:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120706/01b8ae5b/attachment.html>


More information about the calendarserver-changes mailing list