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

Jens Vagelpohl jens at dataflake.org
Fri Sep 3 13:18:23 EDT 2004


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

Modified Files:
      Tag: CMF-1_5-branch
	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.10.2.1 ===
--- 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:18:18 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