[CMF-checkins] CVS: Products/CMFCore/tests - test_ActionInformation.py:1.11

Jens Vagelpohl jens at dataflake.org
Fri Sep 3 13:14:07 EDT 2004


Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv22641/CMFCore/tests

Modified Files:
	test_ActionInformation.py 
Log Message:
- ActionInformation: If a path expression ending in an object that
  gets called using __render_with_namespace__ (such as DTML objects
  and Scripts (Python)) is used a KeyError for "here" would be thrown
  inside PageTemplates.ZRPythonExpr.call_with_ns. call_with_ns
  expects the namespace to contain "here", which the context coming
  from CMFCore.Expressions.createExprContext did not provide. Added
  "here" as an alias pointing to the provided "object"
  (http://www.zope.org/Collectors/CMF/171)


=== Products/CMFCore/tests/test_ActionInformation.py 1.10 => 1.11 ===
--- Products/CMFCore/tests/test_ActionInformation.py:1.10	Thu Aug  5 09:52:32 2004
+++ Products/CMFCore/tests/test_ActionInformation.py	Fri Sep  3 13:14:01 2004
@@ -4,6 +4,8 @@
 Zope.startup()
 from Interface.Verify import verifyClass
 
+from Products.PythonScripts.PythonScript import manage_addPythonScript
+
 from Products.CMFCore.Expression import createExprContext
 from Products.CMFCore.Expression import Expression
 from Products.CMFCore.tests.base.dummy import DummyContent
@@ -139,6 +141,24 @@
         ec = createExprContext(folder, portal, object)
 
         self.failIf(ai.testCondition(ec))
+
+    def test_Condition_PathExpression(self):
+        portal = self.portal
+        folder = self.folder
+        object = self.object
+        manage_addPythonScript(self.root, 'test_script')
+        script = self.root.test_script
+        script.ZPythonScript_edit('', 'return context.getId()')
+        ai = self._makeOne( id='view',
+                            title='View',
+                            action=Expression(text='view'),
+                            condition=Expression(text='portal/test_script'),
+                            category='global',
+                            visible=True )
+        ec = createExprContext(folder, portal, object)
+
+        self.failUnless(ai.testCondition(ec))
+
 
 
 def test_suite():



More information about the CMF-checkins mailing list