[CMF-checkins] CVS: CMF/DCWorkflow - Expression.py:1.9

Chris Withers chrisw@nipltd.com
Mon, 11 Feb 2002 07:44:27 -0500


Update of /cvs-repository/CMF/DCWorkflow
In directory cvs.zope.org:/tmp/cvs-serv10593/DCWorkflow

Modified Files:
	Expression.py 
Log Message:
Fix for Tracker #463. Killed duplicate code in DCWorkflow/Expression.py

=== CMF/DCWorkflow/Expression.py 1.8 => 1.9 ===
 
 from Products.CMFCore.WorkflowCore import ObjectDeleted, ObjectMoved
+from Products.CMFCore.Expression import Expression
 from Products.PageTemplates.Expressions import getEngine
 from Products.PageTemplates.TALES import SafeMapping
-from Products.PageTemplates.PageTemplate import ModuleImporter
-
-
-class Expression (Persistent):
-    text = ''
-    _v_compiled = None
-
-    security = ClassSecurityInfo()
-
-    def __init__(self, text):
-        self.text = text
-        self._v_compiled = getEngine().compile(text)
-
-    def __call__(self, econtext):
-        compiled = self._v_compiled
-        if compiled is None:
-            compiled = self._v_compiled = getEngine().compile(self.text)
-        # ?? Maybe expressions should manipulate the security
-        # context stack.
-        res = compiled(econtext)
-        if isinstance(res, Exception):
-            raise res
-        #print 'returning %s from %s' % (`res`, self.text)
-        return res
-
-Globals.InitializeClass(Expression)
-
+from Products.PageTemplates.Expressions import SecureModuleImporter
 
 class StateChangeInfo:
     '''
@@ -130,7 +105,7 @@
         'nothing':      None,
         'root':         wf.getPhysicalRoot(),
         'request':      getattr( ob, 'REQUEST', None ),
-        'modules':      ModuleImporter,
+        'modules':      SecrueModuleImporter,
         'user':         getSecurityManager().getUser(),
         'state_change': sci,
         'transition':   sci.transition,