[CalendarServer-changes] [11218] CalDAVClientLibrary/trunk/caldavclientlibrary

source_changes at macosforge.org source_changes at macosforge.org
Fri May 17 18:41:40 PDT 2013


Revision: 11218
          http://trac.calendarserver.org//changeset/11218
Author:   cdaboo at apple.com
Date:     2013-05-17 18:41:40 -0700 (Fri, 17 May 2013)
Log Message:
-----------
Need to do share accept POST on the correct home collection based on shared-type.

Modified Paths:
--------------
    CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/notifications.py
    CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py
    CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/calendarserver/notifications.py

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/notifications.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/notifications.py	2013-05-18 01:02:40 UTC (rev 11217)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/browser/commands/notifications.py	2013-05-18 01:41:40 UTC (rev 11218)
@@ -145,7 +145,7 @@
                     continue
 
                 # Now execute and delete the notification if processed OK
-                if self.shell.shell.account.session.processNotification(notifications[number], self.accept):
+                if self.shell.shell.account.session.processNotification(self.shell.account.getPrincipal(None), notifications[number], self.accept):
                     self.shell.shell.account.session.deleteResource(notifications[number].url)
                 break
 

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py	2013-05-18 01:02:40 UTC (rev 11217)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/client/clientsession.py	2013-05-18 01:41:40 UTC (rev 11218)
@@ -855,10 +855,12 @@
         return notifications
 
 
-    def processNotification(self, notification, accept):
+    def processNotification(self, principal, notification, accept):
         """
         Accept or decline a sharing invite in the specified notification.
 
+        @param principal: the principal acting on the notification
+        @type principal: L{CalDAVPrincipal}
         @param notification: the notification
         @type notification: L{InviteNotification}
         @param accept: whether to accept C{True} or decline C{False} the invite
@@ -867,8 +869,8 @@
 
         assert(isinstance(notification.url, URL))
 
-        # POST goes to home which is two segments up from the notification resource
-        rurl = notification.url.dirname().dirname()
+        # POST goes to home and we need to figure that out from the notification
+        rurl = principal.homeset[0] if notification.shared_type == "calendar" else principal.adbkhomeset[0]
 
         # Add invitation POST
         request = ProcessNotification(self, rurl.relativeURL(), notification, accept)

Modified: CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/calendarserver/notifications.py
===================================================================
--- CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/calendarserver/notifications.py	2013-05-18 01:02:40 UTC (rev 11217)
+++ CalDAVClientLibrary/trunk/caldavclientlibrary/protocol/calendarserver/notifications.py	2013-05-18 01:41:40 UTC (rev 11218)
@@ -40,6 +40,7 @@
     def __init__(self):
 
         self.url = None
+        self.shared_type = "calendar"
         self.uid = ""
         self.user_uid = ""
         self.access = "unknown"
@@ -53,6 +54,7 @@
 
         self.url = url
 
+        self.shared_type = notification.get("shared-type", default="calendar")
         self.uid = notification.find(str(csxml.uid)).text
         self.user_uid = notification.find(str(davxml.href)).text
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130517/dbcbe583/attachment.html>


More information about the calendarserver-changes mailing list