[CalendarServer-changes] [10938] CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Sat Mar 16 16:46:55 PDT 2013


Revision: 10938
          http://trac.calendarserver.org//changeset/10938
Author:   gaya at apple.com
Date:     2013-03-16 16:46:55 -0700 (Sat, 16 Mar 2013)
Log Message:
-----------
fix (workaround really) addressbook resourcetype problem.

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

Modified: CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/sharing.py	2013-03-15 21:47:42 UTC (rev 10937)
+++ CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/sharing.py	2013-03-16 23:46:55 UTC (rev 10938)
@@ -122,6 +122,7 @@
         Set the resource-type property on this resource to indicate that this
         is the owner's version of a resource which has been shared.
         """
+        #FIXME: generate resource type dynamically
         # Change resourcetype
         rtype = self.resourceType()
         rtype = element.ResourceType(*(rtype.children + (customxml.SharedOwner(),)))
@@ -131,8 +132,10 @@
     @inlineCallbacks
     def downgradeFromShare(self, request):
 
-        # Change resource type (note this might be called after deleting a resource
+        # Restore resource type (note this might be called after deleting a resource
         # so we have to cope with that)
+        #FIXME: generate resource type dynamically
+        #self.removeDeadProperty((dav_namespace, "resourcetype"))
         rtype = self.resourceType()
         rtype = element.ResourceType(*([child for child in rtype.children if child != customxml.SharedOwner()]))
         self.writeDeadProperty(rtype)
@@ -246,10 +249,12 @@
         Return True if this is an owner shared resource
         Similar to self.isSpecialCollection() but also allows groups
         """
-
         if not self.isCollection() and not self.isGroup():
             return False
 
+        #FIXME: don't use dead properties, try:
+        # returnValue(bool(yield self._allInvitations()))
+
         try:
             resourcetype = self.resourceType()
         except HTTPError, e:

Modified: CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/storebridge.py	2013-03-15 21:47:42 UTC (rev 10937)
+++ CalendarServer/branches/users/gaya/sharedgroups/twistedcaldav/storebridge.py	2013-03-16 23:46:55 UTC (rev 10938)
@@ -142,7 +142,6 @@
                 self._newPropertyStore.keys()]
 
 
-
 def requiresPermissions(*permissions, **kw):
     """
     A decorator to wrap http_ methods in, to indicate that they should not be
@@ -1256,7 +1255,14 @@
         returnValue(result)
 
 
+    def resourceType(self,):
+        if self.hasDeadProperty((dav_namespace, "resourcetype")):
+            return super(CalendarCollectionResource, self).resourceType()
+        else:
+            return caldavxml.ResourceType.calendar
 
+
+
 class StoreScheduleInboxResource(_CalendarCollectionBehaviorMixin, _CommonHomeChildCollectionMixin, ScheduleInboxResource):
 
     def __init__(self, *a, **kw):
@@ -2820,7 +2826,14 @@
         return FORBIDDEN
 
 
+    def resourceType(self,):
+        if self.hasDeadProperty((dav_namespace, "resourcetype")):
+            return super(AddressBookCollectionResource, self).resourceType()
+        else:
+            return carddavxml.ResourceType.addressbook
 
+
+
 class GlobalAddressBookCollectionResource(GlobalAddressBookResource, AddressBookCollectionResource):
     """
     Wrapper around a L{txdav.carddav.iaddressbook.IAddressBook}.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130316/b94a20bb/attachment.html>


More information about the calendarserver-changes mailing list