Commit 2a45ffc2 authored by Jens Vagelpohl's avatar Jens Vagelpohl

- Collector #2232: Can't call DTML templates from Page Templates

parent 1d8df798
...@@ -36,6 +36,8 @@ Zope Changes ...@@ -36,6 +36,8 @@ Zope Changes
Bugs Fixed Bugs Fixed
- Collector #2232: Can't call DTML templates from Page Templates
- Collector #2198: Zope 3.3 fix breaks Five 1.5 test_getNextUtility - Collector #2198: Zope 3.3 fix breaks Five 1.5 test_getNextUtility
- Collector #2206: Set PYTHONPATH to include existing PYTHONPATH - Collector #2206: Set PYTHONPATH to include existing PYTHONPATH
......
...@@ -89,7 +89,7 @@ def render(ob, ns): ...@@ -89,7 +89,7 @@ def render(ob, ns):
if callable(base): if callable(base):
try: try:
if getattr(base, 'isDocTemp', 0): if getattr(base, 'isDocTemp', 0):
ob = call_with_ns(ob, ns, 2) ob = ZRPythonExpr.call_with_ns(ob, ns, 2)
else: else:
ob = ob() ob = ob()
except AttributeError, n: except AttributeError, n:
......
...@@ -12,6 +12,12 @@ class Dummy: ...@@ -12,6 +12,12 @@ class Dummy:
def __call__(self): def __call__(self):
return 'dummy' return 'dummy'
class DummyDocumentTemplate:
__allow_access_to_unprotected_subobjects__ = 1
isDocTemp = True
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
return 'dummy'
class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase): class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase):
def setUp(self): def setUp(self):
...@@ -23,7 +29,8 @@ class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase): ...@@ -23,7 +29,8 @@ class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase):
one = 1, one = 1,
d = {'one': 1, 'b': 'b', '': 'blank', '_': 'under'}, d = {'one': 1, 'b': 'b', '': 'blank', '_': 'under'},
blank = '', blank = '',
dummy = Dummy() dummy = Dummy(),
dummy2 = DummyDocumentTemplate()
) )
def testCompile(self): def testCompile(self):
...@@ -47,7 +54,12 @@ class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase): ...@@ -47,7 +54,12 @@ class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase):
def testRenderedEval(self): def testRenderedEval(self):
ec = self.ec ec = self.ec
assert ec.evaluate('dummy') == 'dummy' self.assertEquals(ec.evaluate('dummy'), 'dummy')
# http://www.zope.org/Collectors/Zope/2232
# DTML templates could not be called from a Page Template
# due to an ImportError
self.assertEquals(ec.evaluate('dummy2'), 'dummy')
def testEval1(self): def testEval1(self):
'''Test advanced expression evaluation 1''' '''Test advanced expression evaluation 1'''
......
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