[CalendarServer-changes] [522]
CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/
Twisted
source_changes at macosforge.org
source_changes at macosforge.org
Mon Nov 20 09:40:18 PST 2006
Revision: 522
http://trac.macosforge.org/projects/calendarserver/changeset/522
Author: cdaboo at apple.com
Date: 2006-11-20 09:40:18 -0800 (Mon, 20 Nov 2006)
Log Message:
-----------
Some things did not get merged right.
Modified Paths:
--------------
CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.resource.patch
CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.static.patch
CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.server.patch
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.resource.patch
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.resource.patch 2006-11-20 16:52:12 UTC (rev 521)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.resource.patch 2006-11-20 17:40:18 UTC (rev 522)
@@ -35,6 +35,15 @@
return succeed(qname in self.liveProperties or self.deadProperties().contains(qname))
def readProperty(self, property, request):
+@@ -253,7 +265,7 @@
+
+ if name == "principal-collection-set":
+ d = self.principalCollections(request)
+- d.addCallback(lambda collections: davxml.PrincipalCollectionSet(*collections))
++ d.addCallback(lambda collections: davxml.PrincipalCollectionSet(*[davxml.HRef.fromString(uri) for uri in collections]))
+ return d
+
+ def ifAllowed(privileges, callback):
@@ -286,7 +298,33 @@
d.addCallback(gotACL)
return d
@@ -340,7 +349,7 @@
# Dynamically update privileges for those ace's that are inherited.
if inheritance:
-@@ -1146,49 +1221,95 @@
+@@ -1146,49 +1221,96 @@
This implementation returns an empty set.
"""
@@ -419,13 +428,14 @@
+ # FIXME: collection = IPrincipalCollectionResource(collection)
+ principal = collection.principalForUser(authid)
+
++ # FIXME: Why return a tuple?
++
yield principal
- principal = principal.getResult()
-
- if isPrincipalResource(principal):
- yield (principal, principalURI)
- return
-+ return
else:
- principalCollections = waitForDeferred(self.principalCollections(request))
- yield principalCollections
@@ -450,7 +460,7 @@
+ @param authid: a string containing the uthentication/authorization identifier
+ for the principal to lookup.
+ @param authnPrincipal: the L{IDAVPrincipal} for the authenticated principal
-+ @return: a deferred result C{tuple} of (L{IDAVPrincipal}, C{str}) containing the authorization principal
++ @return: a deferred result C{tuple} of (L{IDAVPrincipal}, C{str}) containing the authorization principal
+ resource and URI respectively.
+ """
+ return succeed(authnPrincipal)
@@ -458,7 +468,7 @@
def samePrincipal(self, principal1, principal2):
"""
Check whether the two prinicpals are exactly the same in terms of
-@@ -1511,6 +1632,265 @@
+@@ -1511,6 +1633,265 @@
return None
##
@@ -724,7 +734,7 @@
# HTTP
##
-@@ -1558,7 +1938,7 @@
+@@ -1558,7 +1939,7 @@
"""
DAV resource with no children.
"""
@@ -733,7 +743,7 @@
return succeed(None)
class DAVPrincipalResource (DAVLeafResource):
-@@ -1712,6 +2092,37 @@
+@@ -1712,6 +2093,37 @@
davxml.registerElement(TwistedACLInheritable)
davxml.ACE.allowed_children[(twisted_dav_namespace, "inheritable")] = (0, 1)
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.static.patch
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.static.patch 2006-11-20 16:52:12 UTC (rev 521)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.static.patch 2006-11-20 17:40:18 UTC (rev 522)
@@ -8,10 +8,10 @@
-import os
-
-+from twisted.internet.defer import succeed, deferredGenerator, waitForDeferred
- from twisted.python import log
--from twisted.internet.defer import succeed, deferredGenerator, waitForDeferred
+-from twisted.python import log
+ from twisted.internet.defer import succeed, deferredGenerator, waitForDeferred
-from twisted.web2.static import File
++from twisted.python import log
+from twisted.web2 import http_headers
from twisted.web2 import responsecode, dirlist
-from twisted.web2.http import RedirectResponse
@@ -96,7 +96,7 @@
# Workarounds for issues with File
##
-@@ -134,61 +183,58 @@
+@@ -134,61 +183,6 @@
def createSimilarFile(self, path):
return self.__class__(path, defaultType=self.defaultType, indexNames=self.indexNames[:])
@@ -110,58 +110,7 @@
- if not self.fp.exists():
- yield responsecode.NOT_FOUND
- return
-+ # def render(self, request):
-+ # """
-+ # This is a direct copy of web2.static.render with the
-+ # listChildren behavior replaced with findChildren to ensure
-+ # that the current authenticated principal can only list
-+ # directory contents that they have read permissions for.
-+ # """
-+ # if not self.fp.exists():
-+ # return responsecode.NOT_FOUND
-+ #
-+ # if not self.fp.isdir():
-+ # # Do regular resource behavior from superclass
-+ # return super(DAVFile, self).render(request)
-+ #
-+ # #
-+ # # Do custom rendering of directory so that we can enforce ACLs.
-+ # #
-+ #
-+ # if request.uri[-1] != "/":
-+ # # Redirect to include trailing '/' in URI
-+ # return RedirectResponse(request.unparseURL(path=request.path+'/'))
-+ #
-+ # # Render from the index file, if we have one
-+ # index_fp = self.fp.childSearchPreauth(*self.indexNames)
-+ # if index_fp:
-+ # return self.createSimilarFile(index_fp.path).render(request)
-+ #
-+ # # Render from a DirectoryLister
-+ # def findChildren(filtered_aces):
-+ # children = []
-+ #
-+ # def found(request, uri):
-+ # children.append(uri.rstrip("/").split("/")[-1])
-+ #
-+ # d = self.findChildren("1", request, found,
-+ # (davxml.Read(),), inherited_aces=filtered_aces)
-+ # d.addCallback(render, children)
-+ # return d
-+ #
-+ # def render(_, children):
-+ # return dirlist.DirectoryLister(
-+ # self.fp.path,
-+ # children,
-+ # self.contentTypes,
-+ # self.contentEncodings,
-+ # self.defaultType
-+ # ).render(request)
-+ #
-+ # d = self.inheritedACEsforChildren(request)
-+ # d.addCallback(findChildren)
-+ # return d
-
+-
- if self.fp.isdir():
- if request.uri[-1] != "/":
- # Redirect to include trailing '/' in URI
Modified: CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.server.patch
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.server.patch 2006-11-20 16:52:12 UTC (rev 521)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.server.patch 2006-11-20 17:40:18 UTC (rev 522)
@@ -97,7 +97,7 @@
def locateResource(self, url):
"""
-@@ -385,8 +396,13 @@
+@@ -385,7 +396,8 @@
The contained response will have a status code of
L{responsecode.BAD_REQUEST}.
"""
@@ -105,18 +105,18 @@
+ if url is None:
+ return defer.succeed(None)
-+ cached = self._urlsByResource.get(url, None)
-+ if cached is not None:
-+ return defer.succeed(cached)
-+
#
# Parse the URL
- #
-@@ -406,19 +422,66 @@
+@@ -406,19 +418,71 @@
"URL is not on this site (%s://%s/): %s" % (scheme, self.headers.getHeader("host"), url)
))
- segments = path.split("/")
++ # Looked for cached value
++ cached = self._urlsByResource.get(path, None)
++ if cached is not None:
++ return defer.succeed(cached)
++
+ segments = unquote(path).split("/")
assert segments[0] == "", "URL path didn't begin with '/': %s" % (path,)
segments = segments[1:]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061120/99f51829/attachment.html
More information about the calendarserver-changes
mailing list