[CalendarServer-changes] [10035] CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/ sharing.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 15 12:22:51 PST 2012


Revision: 10035
          http://trac.calendarserver.org//changeset/10035
Author:   gaya at apple.com
Date:     2012-11-15 12:22:51 -0800 (Thu, 15 Nov 2012)
Log Message:
-----------
in SharedHomeMixin._acceptShare() write resourcetype to dead properties if shared items is group

Modified Paths:
--------------
    CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/sharing.py

Modified: CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/sharing.py	2012-11-15 20:16:18 UTC (rev 10034)
+++ CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/sharing.py	2012-11-15 20:22:51 UTC (rev 10035)
@@ -39,7 +39,7 @@
 from twisted.internet.defer import succeed, inlineCallbacks, DeferredList, \
     returnValue
 
-from twistedcaldav import customxml, caldavxml
+from twistedcaldav import customxml, caldavxml, carddavxml
 from twistedcaldav.config import config
 from twistedcaldav.customxml import calendarserver_namespace
 from twistedcaldav.directory.wiki import WikiDirectoryService, getWikiAccess
@@ -116,22 +116,19 @@
     def upgradeToShare(self):
         """ Upgrade this collection to a shared state """
 
-        if self.isCollection():
-            # Change resourcetype
-            rtype = self.resourceType()
-            rtype = element.ResourceType(*(rtype.children + (customxml.SharedOwner(),)))
-            self.writeDeadProperty(rtype)
-        # TODO: set group resource type?
+        # Change resourcetype
+        rtype = self.resourceType()
+        rtype = element.ResourceType(*(rtype.children + (customxml.SharedOwner(),)))
+        self.writeDeadProperty(rtype)
 
     @inlineCallbacks
     def downgradeFromShare(self, request):
 
-        if self.isCollection():
-            # Change resource type (note this might be called after deleting a resource
-            # so we have to cope with that)
-            rtype = self.resourceType()
-            rtype = element.ResourceType(*([child for child in rtype.children if child != customxml.SharedOwner()]))
-            self.writeDeadProperty(rtype)
+        # Change resource type (note this might be called after deleting a resource
+        # so we have to cope with that)
+        rtype = self.resourceType()
+        rtype = element.ResourceType(*([child for child in rtype.children if child != customxml.SharedOwner()]))
+        self.writeDeadProperty(rtype)
 
         # Remove all invitees
         for invitation in (yield self._allInvitations()):
@@ -1113,6 +1110,11 @@
         shareeCollection = yield request.locateResource(shareeURL)
         shareeCollection.setShare(share)
 
+        #FIXME: addcresourceType to dead properties for share groups -
+        #        it's already there for shared address book and calendars
+        if isNewShare and sharedCollection.isGroup():
+                shareeCollection.writeDeadProperty(carddavxml.ResourceType.addressbook)
+
         # Set per-user displayname or color to whatever was given
         if displayname:
             yield shareeCollection.writeProperty(element.DisplayName.fromString(displayname), request)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121115/bc977805/attachment.html>


More information about the calendarserver-changes mailing list