[CMF-checkins] CVS: Products/DCWorkflow - DCWorkflow.py:1.36.2.2

Julien Anguenot ja at nuxeo.com
Tue Apr 26 12:01:35 EDT 2005


Update of /cvs-repository/Products/DCWorkflow
In directory cvs.zope.org:/tmp/cvs-serv22317

Modified Files:
      Tag: CMF-1_5-branch
	DCWorkflow.py 
Log Message:
_checkTransitionGuard() supports **kw arguments and propagates them to the guard.check() method. isActionSupported() uses now this facility as well and propagates **kw to the guard.check() method


=== Products/DCWorkflow/DCWorkflow.py 1.36.2.1 => 1.36.2.2 ===
--- Products/DCWorkflow/DCWorkflow.py:1.36.2.1	Wed Mar 16 06:33:53 2005
+++ Products/DCWorkflow/DCWorkflow.py	Tue Apr 26 12:01:34 2005
@@ -250,7 +250,7 @@
         return [ result[1] for result in res ]
 
     security.declarePrivate('isActionSupported')
-    def isActionSupported(self, ob, action):
+    def isActionSupported(self, ob, action, **kw):
         '''
         Returns a true value if the given action name
         is possible in the current state.
@@ -262,7 +262,7 @@
             tdef = self.transitions.get(action, None)
             if (tdef is not None and
                 tdef.trigger_type == TRIGGER_USER_ACTION and
-                self._checkTransitionGuard(tdef, ob)):
+                self._checkTransitionGuard(tdef, ob, **kw)):
                 return 1
         return 0
 
@@ -282,7 +282,7 @@
         if tdef is None or tdef.trigger_type != TRIGGER_USER_ACTION:
             raise WorkflowException, (
                 'Transition %s is not triggered by a user action' % action)
-        if not self._checkTransitionGuard(tdef, ob):
+        if not self._checkTransitionGuard(tdef, ob, **kw):
             raise Unauthorized(action)
         self._changeStateOf(ob, tdef, kw)
 
@@ -442,11 +442,11 @@
                     changed = 1
         return changed
 
-    def _checkTransitionGuard(self, t, ob):
+    def _checkTransitionGuard(self, t, ob, **kw):
         guard = t.guard
         if guard is None:
             return 1
-        if guard.check(getSecurityManager(), self, ob):
+        if guard.check(getSecurityManager(), self, ob, **kw):
             return 1
         return 0
 



More information about the CMF-checkins mailing list