[CMF-checkins] CVS: CMF - CHANGES.txt:1.2 Expression.py:1.2 Guard.py:1.2 version.txt:1.2
shane@digicool.com
shane@digicool.com
Mon, 11 Jun 2001 16:18:15 -0400 (EDT)
Update of /cvs-repository/CMF/DCWorkflow
In directory korak.digicool.com:/tmp/cvs-serv30440
Modified Files:
CHANGES.txt Expression.py Guard.py version.txt
Log Message:
Fixed guard expressions and added getPortal() for expressions.
--- Updated File CHANGES.txt in package CMF --
--- CHANGES.txt 2001/06/11 19:33:47 1.1
+++ CHANGES.txt 2001/06/11 20:18:14 1.2
@@ -1,3 +1,13 @@
+Version 0.3
+
+- Fixed guard expressions. Thanks to Jens Quade!
+
+- Implemented updateRoleMappingsFor(), a new addition to the
+WorkflowDefinition interface.
+
+- Added getPortal() to the expression namespace. Again, thanks to Jens
+Quade.
+
Version 0.2
- As suggested by Seb Bacon, simplified by making transitions trigger on
--- Updated File Expression.py in package CMF --
--- Expression.py 2001/06/11 19:33:47 1.1
+++ Expression.py 2001/06/11 20:18:14 1.2
@@ -148,11 +148,16 @@
Globals.InitializeClass(Expression)
-def exprNamespace(object, workflow, status,
+def exprNamespace(object, workflow, status=None,
transition=None, new_state=None, kwargs=None):
md = TemplateDict()
if kwargs is None:
kwargs = {}
+ if status is None:
+ tool = aq_parent(aq_inner(workflow))
+ status = tool.getStatusOf(workflow.id, object)
+ if status is None:
+ status = {}
md._push(status)
md._push(ExprVars(object, workflow))
d = {'object': object,
@@ -168,7 +173,7 @@
class ExprVars:
'''
- Provides names that depend on both the workflow and the object.
+ Provides names that are more expensive to compute.
'''
def __init__(self, ob, wf):
@@ -190,3 +195,8 @@
else:
return ()
+ def getPortal(self):
+ ob = self._ob
+ while ob is not None and not getattr(ob, '_isPortalRoot', 0):
+ ob = aq_parent(aq_inner(ob))
+ return ob
--- Updated File Guard.py in package CMF --
--- Guard.py 2001/06/11 19:33:47 1.1
+++ Guard.py 2001/06/11 20:18:14 1.2
@@ -97,7 +97,7 @@
from Products.CMFCore.CMFCorePermissions import ManagePortal
-from Expression import Expression
+from Expression import Expression, exprNamespace
from utils import _dtmldir
@@ -137,7 +137,8 @@
return 0
expr = self.expr
if expr is not None:
- res = expr(ob, wf_def)
+ md = exprNamespace(ob, wf_def)
+ res = expr(md)
if not res:
return 0
return 1
--- Updated File version.txt in package CMF --
--- version.txt 2001/06/11 19:33:47 1.1
+++ version.txt 2001/06/11 20:18:14 1.2
@@ -1 +1 @@
-DCWorkflow-0.2
\ No newline at end of file
+DCWorkflow-0.3
\ No newline at end of file