Merge from trunk:

 Log message for revision 68451:
  Allow access to ZopeIterator/PathIterator API from restricted Python
  (e.g. python expressions)
parent e134f69d
......@@ -152,6 +152,10 @@ class ZopeEngine(zope.app.pagetemplate.engine.ZopeEngine):
class ZopeIterator(Iterator):
# allow iterator API to be accessed from (restricted) Python TALES
# expressions
__allow_access_to_unprotected_subobjects__ = True
# The things below used to be attributes in
# ZTUtils.Iterator.Iterator, however in zope.tales.tales.Iterator
# they're methods. We need BBB on the Python level so we redefine
......
......@@ -69,6 +69,14 @@ class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase):
assert ec.evaluate('x | string:$one') == '1'
assert ec.evaluate('x | not:exists:x')
def testIteratorZRPythonExpr(self):
'''Test access to iterator functions from Python expressions'''
ec = self.ec
ec.beginScope()
ec.setRepeat('loop', "python:[1,2,3]")
assert ec.evaluate("python:repeat['loop'].even()")
ec.endScope()
def testWrappers(self):
"""Test if defer and lazy are returning their wrappers
"""
......
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