[Zope-Checkins] SVN: Products.Five/branches/1.4/ Merge 70923:70924
from 1.3 branch
Brian Sutherland
jinty at web.de
Fri Oct 27 04:33:42 EDT 2006
Log message for revision 70925:
Merge 70923:70924 from 1.3 branch
Changed:
U Products.Five/branches/1.4/CHANGES.txt
U Products.Five/branches/1.4/browser/resource.py
U Products.Five/branches/1.4/browser/tests/resource_ftest.txt
A Products.Five/branches/1.4/browser/tests/resource_subdir/
-=-
Modified: Products.Five/branches/1.4/CHANGES.txt
===================================================================
--- Products.Five/branches/1.4/CHANGES.txt 2006-10-27 08:28:58 UTC (rev 70924)
+++ Products.Five/branches/1.4/CHANGES.txt 2006-10-27 08:33:41 UTC (rev 70925)
@@ -20,6 +20,8 @@
* Backported Zope 2.10's pythonproducts zope app handling to help resolve
an issue with ConnectionStateError's.
+* Port code from Zope 3 making resource directories recursive.
+ Thanks to Richard Waid.
Five 1.4.1 (2006-08-13)
=======================
@@ -114,6 +116,16 @@
NOTE: Anyone who copied the Five site.zcml to their
$INSTANCE_HOME/etc/ directory is going to need to update it.
+Five 1.3.8 (unreleased)
+=======================
+
+Bugfixes
+--------
+
+* Port code from Zope 3 making resource directories recursive.
+ Thanks to Richard Waid.
+
+
Five 1.3.7 (2006-08-13)
=======================
Modified: Products.Five/branches/1.4/browser/resource.py
===================================================================
--- Products.Five/branches/1.4/browser/resource.py 2006-10-27 08:28:58 UTC (rev 70924)
+++ Products.Five/branches/1.4/browser/resource.py 2006-10-27 08:33:41 UTC (rev 70925)
@@ -213,12 +213,20 @@
def get(self, name, default=_marker):
path = self.context.path
filename = os.path.join(path, name)
- if not os.path.isfile(filename):
+ isfile = os.path.isfile(filename)
+ isdir = os.path.isdir(filename)
+
+ if not (isfile or isdir):
if default is _marker:
raise KeyError(name)
return default
- ext = name.split('.')[-1]
- factory = self.resource_factories.get(ext, self.default_factory)
+
+ if isfile:
+ ext = name.split('.')[-1]
+ factory = self.resource_factories.get(ext, self.default_factory)
+ else:
+ factory = DirectoryResourceFactory
+
resource = factory(name, filename)(self.request)
resource.__name__ = name
resource.__parent__ = self
Modified: Products.Five/branches/1.4/browser/tests/resource_ftest.txt
===================================================================
--- Products.Five/branches/1.4/browser/tests/resource_ftest.txt 2006-10-27 08:28:58 UTC (rev 70924)
+++ Products.Five/branches/1.4/browser/tests/resource_ftest.txt 2006-10-27 08:33:41 UTC (rev 70925)
@@ -66,6 +66,18 @@
... self.assertEquals(200, response.getStatus())
+We also can traverse into sub-directories:
+
+ >>> print http(r'''
+ ... GET /test_folder_1_/testoid/++resource++fivetest_resources/resource_subdir/resource.txt HTTP/1.1
+ ... Authorization: Basic manager:r00t
+ ... ''')
+ HTTP/1.1 200 OK
+ ...
+ This is a resource in a subdirectory of a normal resource to test traversal.
+ <BLANKLINE>
+
+
Clean up
--------
Copied: Products.Five/branches/1.4/browser/tests/resource_subdir (from rev 70924, Products.Five/branches/1.3/browser/tests/resource_subdir)
More information about the Zope-Checkins
mailing list