[CalendarServer-changes] [393]
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.static.
patch
source_changes at macosforge.org
source_changes at macosforge.org
Tue Nov 7 19:50:50 PST 2006
Revision: 393
http://trac.macosforge.org/projects/calendarserver/changeset/393
Author: wsanchez at apple.com
Date: 2006-11-07 19:50:49 -0800 (Tue, 07 Nov 2006)
Log Message:
-----------
Unroll defgen
Modified Paths:
--------------
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.static.patch
Modified: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.static.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.static.patch 2006-11-08 03:20:51 UTC (rev 392)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.static.patch 2006-11-08 03:50:49 UTC (rev 393)
@@ -96,12 +96,94 @@
# Workarounds for issues with File
##
-@@ -164,7 +213,7 @@
- children = []
+@@ -142,53 +191,50 @@
+ directory contents that they have read permissions for.
+ """
+ if not self.fp.exists():
+- yield responsecode.NOT_FOUND
+- return
++ return responsecode.NOT_FOUND
- def found(request, uri):
+- if self.fp.isdir():
+- if request.uri[-1] != "/":
+- # Redirect to include trailing '/' in URI
+- yield RedirectResponse(
+- request.unparseURL(path=request.path+'/'))
+- return
+- else:
+- ifp = self.fp.childSearchPreauth(*self.indexNames)
+- if ifp:
+- # Render from the index file
+- standin = self.createSimilarFile(ifp.path)
+- else:
+- filtered_aces = waitForDeferred(self.inheritedACEsforChildren(request))
+- yield filtered_aces
+- filtered_aces = filtered_aces.getResult()
++ if not self.fp.isdir():
++ # Do regular resource behavior from superclass
++ return super(DAVFile, self).render(request)
+
+- children = []
++ #
++ # Do custom rendering of directory so that we can enforce ACLs.
++ #
+
+- def found(request, uri):
- children.append(uri.split("/")[-1].rstrip("/"))
-+ children.append(uri.rstrip("/").split("/")[-1])
++ if request.uri[-1] != "/":
++ # Redirect to include trailing '/' in URI
++ return RedirectResponse(request.unparseURL(path=request.path+'/'))
- x = waitForDeferred(
- self.findChildren("1", request, found, (davxml.Read(),),
+- x = waitForDeferred(
+- self.findChildren("1", request, found, (davxml.Read(),),
+- inherited_aces=filtered_aces)
+- )
+- yield x
+- x = x.getResult()
++ # 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
+- standin = dirlist.DirectoryLister(
+- self.fp.path,
+- children,
+- self.contentTypes,
+- self.contentEncodings,
+- self.defaultType
+- )
+- yield standin.render(request)
+- return
++ # Render from a DirectoryLister
++ def findChildren(filtered_aces):
++ children = []
+
+- # Do regular resource behavior from superclass
+- yield super(DAVFile, self).render(request)
+-
+- render = deferredGenerator(render)
++ 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
++
+ #
+ # Attach method handlers to DAVFile
+ #
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061107/1485722a/attachment.html
More information about the calendarserver-changes
mailing list