[CalendarServer-changes] [2292] CalendarServer/branches/propfind-cache/twistedcaldav/resource.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 9 12:32:44 PDT 2008


Revision: 2292
          http://trac.macosforge.org/projects/calendarserver/changeset/2292
Author:   dreid at apple.com
Date:     2008-04-09 12:32:42 -0700 (Wed, 09 Apr 2008)

Log Message:
-----------
CalDAVResource changed implementation with tests.

Modified Paths:
--------------
    CalendarServer/branches/propfind-cache/twistedcaldav/resource.py

Modified: CalendarServer/branches/propfind-cache/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/propfind-cache/twistedcaldav/resource.py	2008-04-09 17:59:53 UTC (rev 2291)
+++ CalendarServer/branches/propfind-cache/twistedcaldav/resource.py	2008-04-09 19:32:42 UTC (rev 2292)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2005-2008 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -156,7 +156,7 @@
                 d = self.owner(request)
                 d.addCallback(lambda x: davxml.Owner(x))
                 return d
-            
+
         elif namespace == caldav_namespace:
             if name == "supported-calendar-component-set":
                 # CalDAV-access-09, section 5.2.3
@@ -195,7 +195,7 @@
                         responsecode.NOT_IMPLEMENTED,
                         "Component %s is not supported by this server" % (component.toxml(),)
                     ))
-                    
+
         # Strictly speaking CalDAV:timezone is a live property in the sense that the
         # server enforces what can be stored, however it need not actually
         # exist so we cannot list it in liveProperties on this resource, since its
@@ -313,7 +313,7 @@
         owner = d.getResult()
         result = (davxml.Principal(owner) == self.currentPrincipal(request))
         yield result
- 
+
     ##
     # CalDAV
     ##
@@ -351,13 +351,13 @@
 
         def checkPrivilegesError(failure):
             failure.trap(AccessDeniedError)
-            
+
             reactor.callLater(0, getChild)
 
         def checkPrivileges(child):
             if privileges is None:
                 return child
-   
+
             ca = child.checkPrivileges(request, privileges)
             ca.addCallback(lambda ign: child)
             return ca
@@ -366,7 +366,7 @@
             if child.isCalendarCollection():
                 callback(child, childpath)
             elif child.isCollection():
-                if depth == "infinity": 
+                if depth == "infinity":
                     fc = child.findCalendarCollections(depth, request, callback, privileges)
                     fc.addCallback(lambda x: reactor.callLater(0, getChild))
                     return fc
@@ -478,10 +478,10 @@
         calendar collection have the same privileges unless explicitly overridden. The same applies
         to drop box collections as we want all resources (attachments) to have the same privileges as
         the drop box collection.
-        
+
         @param newaces: C{list} of L{ACE} for ACL being set.
         """
-        
+
         # Do this only for regular calendar collections and Inbox/Outbox
         if self.isPseudoCalendarCollection():
             edited_aces = []
@@ -494,7 +494,7 @@
                     edited_aces.append(ace)
         else:
             edited_aces = newaces
-        
+
         # Do inherited with possibly modified set of aces
         super(CalDAVResource, self).writeNewACEs(edited_aces)
 
@@ -510,6 +510,25 @@
         """
         return request.locateResource(parentForURL(uri))
 
+
+    def changed(self, request, uri, properties=False, data=False):
+        """
+        Notifies that this resource has changed either it's properties or it's
+        data.
+
+        @param request: an L{IRequest} object for the request being processed.
+        @param uri: The URI that has changed.
+
+        @param properties: A C{bool} indicating that properties on C{uri} have
+            changed.
+        @param data: A C{bool} indicating that data at C{uri} has changed.
+        """
+        return self.locateParent(request, uri).changed(request,
+                                                       uri,
+                                                       properties=properties,
+                                                       data=data)
+
+
 class CalendarPrincipalCollectionResource (DAVPrincipalCollectionResource, CalDAVResource):
     """
     CalDAV principal collection.
@@ -675,14 +694,14 @@
             def getFreeBusy(has):
                 if not has:
                     return ()
-    
+
                 def parseFreeBusy(freeBusySet):
                     return tuple(str(href) for href in freeBusySet.children)
-        
+
                 d = inbox.readProperty((caldav_namespace, "calendar-free-busy-set"), request)
                 d.addCallback(parseFreeBusy)
                 return d
-    
+
             d = inbox.hasProperty((caldav_namespace, "calendar-free-busy-set"), request)
             d.addCallback(getFreeBusy)
             return d
@@ -710,10 +729,10 @@
         """
         if self.hasDeadProperty((caldav_namespace, "schedule-outbox-URL")):
             outbox = self.readDeadProperty((caldav_namespace, "schedule-outbox-URL"))
-            return str(outbox.children[0])        
+            return str(outbox.children[0])
         else:
             return None
-        
+
     def dropboxURL(self):
         """
         @return: the drop box home collection URL for this principal.
@@ -723,7 +742,7 @@
             return str(inbox.children[0])
         else:
             return None
-        
+
     def notificationsURL(self):
         """
         @return: the notifications collection URL for this principal.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080409/946d6c00/attachment-0001.html


More information about the calendarserver-changes mailing list