[CalendarServer-changes] [394] CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.resource. patch

source_changes at macosforge.org source_changes at macosforge.org
Tue Nov 7 20:47:23 PST 2006


Revision: 394
          http://trac.macosforge.org/projects/calendarserver/changeset/394
Author:   wsanchez at apple.com
Date:     2006-11-07 20:47:22 -0800 (Tue, 07 Nov 2006)

Log Message:
-----------
Handle case where child dissapears after list of children is obtained.

Modified Paths:
--------------
    CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.resource.patch

Modified: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.resource.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.resource.patch	2006-11-08 03:50:49 UTC (rev 393)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.resource.patch	2006-11-08 04:47:22 UTC (rev 394)
@@ -88,16 +88,58 @@
      def listAllprop(self, request):
          """
          Some DAV properties should not be returned to a C{DAV:allprop} query.
-@@ -535,7 +585,7 @@
+@@ -509,6 +559,9 @@
+             reactor.callLater(0, getChild)
+ 
+         def checkPrivileges(child):
++            if child is None:
++                return None
++
+             if privileges is None:
+                 return child
+    
+@@ -517,14 +570,17 @@
+             return d
+ 
+         def gotChild(child, childpath):
+-            if child.isCollection():
+-                callback(child, childpath + "/")
+-                if depth == "infinity":
+-                    d = child.findChildren(depth, request, callback, privileges)
+-                    d.addCallback(lambda x: reactor.callLater(0, getChild))
+-                    return d
++            if child is None:
++                callback(None, childpath + "/")
+             else:
+-                callback(child, childpath)
++                if child.isCollection():
++                    callback(child, childpath + "/")
++                    if depth == "infinity":
++                        d = child.findChildren(depth, request, callback, privileges)
++                        d.addCallback(lambda x: reactor.callLater(0, getChild))
++                        return d
++                else:
++                    callback(child, childpath)
+ 
+             reactor.callLater(0, getChild)
+ 
+@@ -535,10 +591,11 @@
                  completionDeferred.callback(None)
              else:
                  childpath = joinURL(basepath, childname)
 -                child = request.locateResource(childpath)
-+                child = request.locateChildResource(self, childname)
-                 child.addCallback(checkPrivileges)
-                 child.addCallbacks(gotChild, checkPrivilegesError, (childpath,))
-                 child.addErrback(completionDeferred.errback)
-@@ -564,7 +614,7 @@
+-                child.addCallback(checkPrivileges)
+-                child.addCallbacks(gotChild, checkPrivilegesError, (childpath,))
+-                child.addErrback(completionDeferred.errback)
++                print "*"*10, childname, childpath
++                d = request.locateChildResource(self, childname)
++                d.addCallback(checkPrivileges)
++                d.addCallbacks(gotChild, checkPrivilegesError, (childpath,))
++                d.addErrback(completionDeferred.errback)
+ 
+         getChild()
+ 
+@@ -564,7 +621,7 @@
          See L{IDAVResource.authorize}.
          """
          def onError(failure):
@@ -106,7 +148,7 @@
              raise HTTPError(UnauthorizedResponse(
                  request.credentialFactories,
                  request.remoteAddr
-@@ -574,9 +624,9 @@
+@@ -574,9 +631,9 @@
              def onErrors(failure):
                  failure.trap(AccessDeniedError)
                  
@@ -118,7 +160,7 @@
                      response = UnauthorizedResponse(request.credentialFactories,
                                                      request.remoteAddr)
                  else:
-@@ -594,22 +644,29 @@
+@@ -594,22 +651,29 @@
              return d
  
          d = maybeDeferred(self.authenticate, request)
@@ -153,7 +195,7 @@
  
          authHeader = request.headers.getHeader('authorization')
  
-@@ -625,9 +682,11 @@
+@@ -625,9 +689,11 @@
  
                  # Try to match principals in each principal collection on the resource
                  def gotDetails(details):
@@ -168,7 +210,7 @@
  
                  def login(pcreds):
                      d = request.portal.login(pcreds, None, *request.loginInterfaces)
-@@ -635,13 +694,14 @@
+@@ -635,13 +701,14 @@
  
                      return d
  
@@ -186,7 +228,7 @@
  
      ##
      # ACL
-@@ -650,10 +710,10 @@
+@@ -650,10 +717,10 @@
      def currentPrincipal(self, request):
          """
          @param request: the request being processed.
@@ -200,7 +242,7 @@
          else:
              return unauthenticatedPrincipal
  
-@@ -666,32 +726,26 @@
+@@ -666,32 +733,26 @@
          present on this resource, it tries to get it from the parent, unless it
          is the root or has no parent.
          """
@@ -249,7 +291,7 @@
      def defaultAccessControlList(self):
          """
          @return: the L{davxml.ACL} element containing the default access control
-@@ -1146,49 +1200,95 @@
+@@ -1146,49 +1207,95 @@
  
          This implementation returns an empty set.
          """
@@ -362,7 +404,7 @@
      def samePrincipal(self, principal1, principal2):
          """
          Check whether the two prinicpals are exactly the same in terms of
-@@ -1511,6 +1611,265 @@
+@@ -1511,6 +1618,265 @@
          return None
  
      ##
@@ -628,7 +670,7 @@
      # HTTP
      ##
  
-@@ -1558,7 +1917,7 @@
+@@ -1558,7 +1924,7 @@
      """
      DAV resource with no children.
      """
@@ -637,7 +679,7 @@
          return succeed(None)
  
  class DAVPrincipalResource (DAVLeafResource):
-@@ -1712,6 +2071,37 @@
+@@ -1712,6 +2078,37 @@
  davxml.registerElement(TwistedACLInheritable)
  davxml.ACE.allowed_children[(twisted_dav_namespace, "inheritable")] = (0, 1)
  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061107/cfea7b30/attachment.html


More information about the calendarserver-changes mailing list