[CalendarServer-changes] [9201] CalendarServer/branches/users/glyph/sharing-api

source_changes at macosforge.org source_changes at macosforge.org
Thu Apr 26 17:09:08 PDT 2012


Revision: 9201
          http://trac.macosforge.org/projects/calendarserver/changeset/9201
Author:   glyph at apple.com
Date:     2012-04-26 17:09:08 -0700 (Thu, 26 Apr 2012)
Log Message:
-----------
insert invite query so that clients can actually see the share

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sharing-api/txdav/caldav/datastore/test/common.py
    CalendarServer/branches/users/glyph/sharing-api/txdav/common/datastore/sql.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/sharing-api/

Modified: CalendarServer/branches/users/glyph/sharing-api/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/glyph/sharing-api/txdav/caldav/datastore/test/common.py	2012-04-27 00:09:03 UTC (rev 9200)
+++ CalendarServer/branches/users/glyph/sharing-api/txdav/caldav/datastore/test/common.py	2012-04-27 00:09:08 UTC (rev 9201)
@@ -1003,6 +1003,13 @@
             (yield
              (yield normalCal.calendarObjectWithName("1.ics")).component())
         )
+        # Check legacy shares database too, since that's what the protocol layer
+        # is still using to list things.
+        self.assertEqual(
+            [(record.shareuid, record.localname) for record in
+             (yield otherHome.retrieveOldShares().allRecords())],
+            [(newCalName, newCalName)]
+        )
 
 
     @inlineCallbacks

Modified: CalendarServer/branches/users/glyph/sharing-api/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/sharing-api/txdav/common/datastore/sql.py	2012-04-27 00:09:03 UTC (rev 9200)
+++ CalendarServer/branches/users/glyph/sharing-api/txdav/common/datastore/sql.py	2012-04-27 00:09:08 UTC (rev 9201)
@@ -168,22 +168,21 @@
 
     def eachCalendarHome(self):
         """
-        @see L{ICalendarStore.eachCalendarHome}
+        @see: L{ICalendarStore.eachCalendarHome}
         """
         return []
 
 
     def eachAddressbookHome(self):
         """
-        @see L{IAddressbookStore.eachAddressbookHome}
+        @see: L{IAddressbookStore.eachAddressbookHome}
         """
         return []
 
 
-
     def newTransaction(self, label="unlabeled"):
         """
-        @see L{IDataStore.newTransaction}
+        @see: L{IDataStore.newTransaction}
         """
         txn = CommonStoreTransaction(
             self,
@@ -1944,6 +1943,20 @@
         return cls._allHomeChildrenQuery(False)
 
 
+    @classproperty
+    def _insertInviteQuery(cls): #@NoSelf
+        inv = schema.INVITE
+        return Insert(
+            {
+                inv.INVITE_UID: Parameter("uid"),
+                inv.NAME: Parameter("name"),
+                inv.HOME_RESOURCE_ID: Parameter("homeID"),
+                inv.RESOURCE_ID: Parameter("resourceID"),
+                inv.RECIPIENT_ADDRESS: Parameter("recipient")
+            }
+        )
+
+
     @inlineCallbacks
     def shareWithUID(self, homeUID, mode):
         """
@@ -1963,10 +1976,15 @@
         newName = str(uuid4())
         yield self._bindInsertQuery.on(
             self._txn, homeID=shareeHome._resourceID,
-            resourceID=self._resourceID, name=newName, bindMode=mode,
+            resourceID=self._resourceID, name=newName, mode=mode,
             seenByOwner=True, seenBySharee=True,
             bindStatus=_BIND_STATUS_ACCEPTED,
         )
+        yield self._insertInviteQuery.on(
+            self._txn, uid=newName, name=newName,
+            homeID=shareeHome._resourceID, resourceID=self._resourceID,
+            recipient=homeUID
+        )
         returnValue(newName)
 
 
@@ -2176,7 +2194,7 @@
             bind.HOME_RESOURCE_ID: Parameter("homeID"),
             bind.RESOURCE_ID: Parameter("resourceID"),
             bind.RESOURCE_NAME: Parameter("name"),
-            bind.BIND_MODE: Parameter("bindMode"),
+            bind.BIND_MODE: Parameter("mode"),
             bind.BIND_STATUS: Parameter("bindStatus"),
             bind.SEEN_BY_OWNER: Parameter("seenByOwner"),
             bind.SEEN_BY_SHAREE: Parameter("seenBySharee"),
@@ -2205,7 +2223,7 @@
         # Bind table needs entry
         yield cls._bindInsertQuery.on(
             home._txn, homeID=home._resourceID, resourceID=resourceID,
-            name=name, bindMode=_BIND_MODE_OWN, seenByOwner=True,
+            name=name, mode=_BIND_MODE_OWN, seenByOwner=True,
             seenBySharee=True, bindStatus=_BIND_STATUS_ACCEPTED
         )
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120426/755f5c52/attachment.html>


More information about the calendarserver-changes mailing list