[Checkins] SVN: Zope/trunk/ - Collector #2232: Can't call DTML templates from Page Templates

Jens Vagelpohl jens at dataflake.org
Sun Nov 12 10:38:41 EST 2006


Log message for revision 71110:
  - Collector #2232: Can't call DTML templates from Page Templates
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Products/PageTemplates/Expressions.py
  U   Zope/trunk/lib/python/Products/PageTemplates/tests/testExpressions.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2006-11-12 15:13:03 UTC (rev 71109)
+++ Zope/trunk/doc/CHANGES.txt	2006-11-12 15:38:40 UTC (rev 71110)
@@ -36,6 +36,8 @@
 
     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 #2206: Set PYTHONPATH to include existing PYTHONPATH

Modified: Zope/trunk/lib/python/Products/PageTemplates/Expressions.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/Expressions.py	2006-11-12 15:13:03 UTC (rev 71109)
+++ Zope/trunk/lib/python/Products/PageTemplates/Expressions.py	2006-11-12 15:38:40 UTC (rev 71110)
@@ -89,7 +89,7 @@
         if callable(base):
             try:
                 if getattr(base, 'isDocTemp', 0):
-                    ob = call_with_ns(ob, ns, 2)
+                    ob = ZRPythonExpr.call_with_ns(ob, ns, 2)
                 else:
                     ob = ob()
             except AttributeError, n:

Modified: Zope/trunk/lib/python/Products/PageTemplates/tests/testExpressions.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/tests/testExpressions.py	2006-11-12 15:13:03 UTC (rev 71109)
+++ Zope/trunk/lib/python/Products/PageTemplates/tests/testExpressions.py	2006-11-12 15:38:40 UTC (rev 71110)
@@ -12,6 +12,12 @@
     def __call__(self):
         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):
 
     def setUp(self):
@@ -23,7 +29,8 @@
             one = 1,
             d = {'one': 1, 'b': 'b', '': 'blank', '_': 'under'},
             blank = '',
-            dummy = Dummy()
+            dummy = Dummy(),
+            dummy2 = DummyDocumentTemplate()
             )
 
     def testCompile(self):
@@ -47,8 +54,13 @@
 
     def testRenderedEval(self):
         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):
         '''Test advanced expression evaluation 1'''
         ec = self.ec



More information about the Checkins mailing list