Commit 9edd2ed0 authored by David Glick's avatar David Glick

follow-up to r92860...unrestrictedTraverse also needs to acquisition-wrap...

follow-up to r92860...unrestrictedTraverse also needs to acquisition-wrap implicit acquirers found via adaptation (fixing regression from merge of philikon-aq branch)
parent f2d029ba
......@@ -263,6 +263,8 @@ class Traversable:
Interface, name)
if next is not None:
if IAcquirer.providedBy(next):
next = next.__of__(obj)
if restricted and not validate(obj, obj, name, next):
raise Unauthorized(name)
elif bobo_traverse is not None:
......
......@@ -397,6 +397,7 @@ class TestTraverse( unittest.TestCase ):
self.failUnless(
self.folder1.unrestrictedTraverse('+something') is 'plus')
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
......@@ -468,6 +469,13 @@ def test_traversable():
... name="raise-keyerror"
... permission="zope2.Public"
... />
... <!-- an item that can be traversed to via adaptation -->
... <browser:page
... for="*"
... class="Products.Five.tests.testing.fancycontent.FancyContent"
... name="acquirer"
... permission="zope2.Public"
... />
... </configure>'''
>>> zcml.load_string(configure_zcml)
......@@ -526,6 +534,13 @@ def test_traversable():
... 'an_attribute').index_html({})
'an_attribute'
If we traverse to something via an adapter lookup and it provides IAcquirer,
it should get acquisition-wrapped so we can acquire attributes implicitly:
>>> acquirer = self.folder.unrestrictedTraverse('acquirer')
>>> acquirer.fancy
<FancyContent ...>
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