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

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

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.10/doc/CHANGES.txt  2006-11-11 17:27:28 UTC (rev 71108)
+++ Zope/branches/2.10/doc/CHANGES.txt  2006-11-12 15:13:03 UTC (rev 71109)
@@ -8,6 +8,8 @@
 
     Bugs fixed
 
+      - Collector #2232: Can't call DTML templates from Page Templates
+
       - Collector #2213: Can't edit "old" ZopePageTemplate instances.
 
       - Collector #2208: rewriting/setting the 'charset' part of the

Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py 
2006-11-11 17:27:28 UTC (rev 71108)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/Expressions.py 
2006-11-12 15:13:03 UTC (rev 71109)
@@ -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/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py
===================================================================
--- 
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py   
    2006-11-11 17:27:28 UTC (rev 71108)
+++ 
Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testExpressions.py   
    2006-11-12 15:13:03 UTC (rev 71109)
@@ -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

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to