[CalendarServer-changes] [4527] CalendarServer/branches/more-deferreds-3/lib-patches/Twisted
source_changes at macosforge.org
source_changes at macosforge.org
Fri Sep 4 15:55:18 PDT 2009
Revision: 4527
http://trac.macosforge.org/projects/calendarserver/changeset/4527
Author: sagen at apple.com
Date: 2009-09-04 15:55:14 -0700 (Fri, 04 Sep 2009)
Log Message:
-----------
Yield waitForDeferred(d), not d!
Modified Paths:
--------------
CalendarServer/branches/more-deferreds-3/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch
CalendarServer/branches/more-deferreds-3/lib-patches/Twisted/twisted.web2.dav.resource.patch
Modified: CalendarServer/branches/more-deferreds-3/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch
===================================================================
--- CalendarServer/branches/more-deferreds-3/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch 2009-09-04 21:03:33 UTC (rev 4526)
+++ CalendarServer/branches/more-deferreds-3/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch 2009-09-04 22:55:14 UTC (rev 4527)
@@ -33,7 +33,7 @@
content_type = request.headers.getHeader("content-type")
if content_type is not None:
- destination.writeDeadProperty(davxml.GETContentType.fromString(generateContentType(content_type)))
-+ ignore = destination.writeDeadProperty(davxml.GETContentType.fromString(generateContentType(content_type)))
++ ignore = waitForDeferred(destination.writeDeadProperty(davxml.GETContentType.fromString(generateContentType(content_type))))
+ yield ignore
+ ignore = ignore.getResult( )
Modified: CalendarServer/branches/more-deferreds-3/lib-patches/Twisted/twisted.web2.dav.resource.patch
===================================================================
--- CalendarServer/branches/more-deferreds-3/lib-patches/Twisted/twisted.web2.dav.resource.patch 2009-09-04 21:03:33 UTC (rev 4526)
+++ CalendarServer/branches/more-deferreds-3/lib-patches/Twisted/twisted.web2.dav.resource.patch 2009-09-04 22:55:14 UTC (rev 4527)
@@ -126,7 +126,7 @@
if (qname not in qnames) and (qname[0] != twisted_private_namespace):
qnames.add(qname)
-@@ -495,37 +529,58 @@
+@@ -495,37 +529,47 @@
in the dead property store may or may not be ignored when reading the
property with L{readProperty}.
"""
@@ -182,22 +182,11 @@
- return super(DAVPropertyMixIn, self).displayName()
+ returnValue((yield super(DAVPropertyMixIn, self).displayName()))
-+ """
-+ def callback(result):
-+ if result:
-+ return str(self.readDeadProperty((davxml.dav_namespace, "displayname")))
-+ else:
-+ return super(DAVPropertyMixIn, self).displayName()
+
-+ d = self.hasDeadProperty((davxml.dav_namespace, "displayname"))
-+ d.addCallback(callback)
-+ return d
-+ """
-+
class DAVResource (DAVPropertyMixIn, StaticRenderMixin):
"""
WebDAV resource.
-@@ -578,11 +633,10 @@
+@@ -578,11 +622,10 @@
completionDeferred = Deferred()
basepath = request.urlForResource(self)
@@ -211,7 +200,7 @@
def checkPrivileges(child):
if child is None:
-@@ -595,7 +649,7 @@
+@@ -595,7 +638,7 @@
d.addCallback(lambda _: child)
return d
@@ -220,7 +209,7 @@
if child is None:
callback(None, childpath + "/")
else:
-@@ -603,14 +657,15 @@
+@@ -603,14 +646,15 @@
callback(child, childpath + "/")
if depth == "infinity":
d = child.findChildren(depth, request, callback, privileges)
@@ -239,7 +228,7 @@
try:
childname = children.pop()
except IndexError:
-@@ -619,10 +674,10 @@
+@@ -619,10 +663,10 @@
childpath = joinURL(basepath, childname)
d = request.locateChildResource(self, childname)
d.addCallback(checkPrivileges)
@@ -252,7 +241,7 @@
return completionDeferred
-@@ -642,41 +697,43 @@
+@@ -642,41 +686,43 @@
# Authentication
##
@@ -323,7 +312,7 @@
def authenticate(self, request):
if not (
hasattr(request, 'portal') and
-@@ -761,7 +818,7 @@
+@@ -761,7 +807,7 @@
# and deny any type of write access (PUT, DELETE, etc.) to
# everything.
#
@@ -332,7 +321,7 @@
def defaultAccessControlList(self):
"""
-@@ -772,7 +829,7 @@
+@@ -772,7 +818,7 @@
# The default behaviour is no ACL; we should inherrit from the parent
# collection.
#
@@ -341,7 +330,7 @@
def setAccessControlList(self, acl):
"""
-@@ -781,7 +838,7 @@
+@@ -781,7 +827,7 @@
This implementation stores the ACL in the private property
C{(L{twisted_private_namespace}, "acl")}.
"""
@@ -350,7 +339,7 @@
def mergeAccessControlList(self, new_acl, request):
"""
-@@ -926,7 +983,9 @@
+@@ -926,7 +972,9 @@
# FIXME: verify acl is self-consistent
# Step 11
@@ -361,7 +350,7 @@
yield None
mergeAccessControlList = deferredGenerator(mergeAccessControlList)
-@@ -1089,7 +1148,9 @@
+@@ -1089,7 +1137,9 @@
return url
try:
@@ -372,7 +361,7 @@
except HTTPError, e:
assert e.response.code == responsecode.NOT_FOUND, (
"Expected %s response from readDeadProperty() exception, not %s"
-@@ -1102,9 +1163,11 @@
+@@ -1102,9 +1152,11 @@
if myURL == "/":
# If we get to the root without any ACLs, then use the default.
@@ -386,7 +375,7 @@
# Dynamically update privileges for those ace's that are inherited.
if inheritance:
-@@ -1223,16 +1286,21 @@
+@@ -1223,16 +1275,21 @@
It will errback with an HTTPError(responsecode.FORBIDDEN) if
the principal isn't found.
"""
@@ -412,7 +401,7 @@
def findPrincipalForAuthID(self, authid):
"""
Return authentication and authoirization prinicipal identifiers for the
-@@ -1247,11 +1315,16 @@
+@@ -1247,11 +1304,16 @@
If not found return None.
"""
for collection in self.principalCollections():
@@ -432,8 +421,16 @@
def authorizationPrincipal(self, request, authid, authnPrincipal):
"""
Determine the authorization principal for the given request and authentication principal.
-@@ -1635,7 +1708,9 @@
+@@ -1535,6 +1597,7 @@
+ # Check disabled
+ if acl is None:
++ # MOR: Is this allowed? (a non-deferred yield in the middle of a generator)
+ yield []
+
+ granted = []
+@@ -1635,7 +1698,9 @@
+
# Check this resource first
if self.isCollection():
- qroot = self.quotaRoot(request)
@@ -443,7 +440,7 @@
if qroot is not None:
used = waitForDeferred(self.currentQuotaUse(request))
yield used
-@@ -1666,14 +1741,17 @@
+@@ -1666,14 +1731,17 @@
def hasQuota(self, request):
"""
@@ -463,7 +460,7 @@
yield True
return
-@@ -1705,10 +1783,19 @@
+@@ -1705,10 +1773,19 @@
@return: a C{int} containing the maximum allowed bytes if this collection
is quota-controlled, or C{None} if not quota controlled.
"""
@@ -486,7 +483,7 @@
def quotaRootParent(self, request):
"""
-@@ -1724,7 +1811,10 @@
+@@ -1724,7 +1801,10 @@
parent = waitForDeferred(request.locateResource(url))
yield parent
parent = parent.getResult()
@@ -498,7 +495,7 @@
yield parent
return
-@@ -1741,11 +1831,19 @@
+@@ -1741,11 +1821,19 @@
assert maxsize is None or isinstance(maxsize, int), "maxsize must be an int or None"
if maxsize is not None:
@@ -521,7 +518,7 @@
def quotaSize(self, request):
"""
-@@ -1795,7 +1893,10 @@
+@@ -1795,7 +1883,10 @@
# Check this resource first
if self.isCollection():
@@ -533,7 +530,7 @@
d = waitForDeferred(self.updateQuotaUse(request, adjust))
yield d
d.getResult()
-@@ -1825,20 +1926,34 @@
+@@ -1825,20 +1916,34 @@
is quota-controlled, or C{None} if not quota controlled.
"""
assert self.isCollection(), "Only collections can have a quota root"
@@ -577,7 +574,7 @@
def updateQuotaUse(self, request, adjust):
"""
Update the quota used value on this resource.
-@@ -1848,25 +1963,32 @@
+@@ -1848,25 +1953,32 @@
@return: an L{Deferred} with a C{int} result containing the current used byte if this collection
is quota-controlled, or C{None} if not quota controlled.
"""
@@ -627,7 +624,7 @@
##
# HTTP
##
-@@ -1880,7 +2002,7 @@
+@@ -1880,7 +1992,7 @@
# If this is a collection and the URI doesn't end in "/", redirect.
#
if self.isCollection() and request.path[-1:] != "/":
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090904/10651094/attachment-0001.html>
More information about the calendarserver-changes
mailing list