Commit 1b105b23 authored by Martin Aspeli's avatar Martin Aspeli

Merge r110185 from 2.12 branch

parent a93eaae4
......@@ -162,6 +162,11 @@ class DirectoryResource(Resource,
resource = factory(name, filename)(self.request)
resource.__name__ = name
resource.__parent__ = self
# We need to propagate security so that restrictedTraverse() will
# work
resource.__roles__ = self.__roles__
return resource
class DirectoryResourceFactory(ResourceFactory):
......
......@@ -69,7 +69,6 @@ PageTemplateResource's __call__ renders the template
... if not isinstance(resource, PageTemplateResource):
... self.assertEquals(resource(), base_url % r)
Security
--------
......@@ -108,6 +107,14 @@ We can now view them all:
... path = base % resource
... checkRestricted(self.folder, 'context.restrictedTraverse("%s")' % path)
Let's make sure restrictedTraverse() works directly, too. It used to get
tripped up on subdirectories due to missing security declarations.
>>> self.folder.restrictedTraverse('++resource++fivetest_resources/resource.txt') is not None
True
>>> self.folder.restrictedTraverse('++resource++fivetest_resources/resource_subdir/resource.txt') is not None
True
Clean up
--------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment