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

Julien Anguenot ja at nuxeo.com
Tue Apr 26 11:36:59 EDT 2005


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

Modified Files:
	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.38 => 1.39 ===
--- Products/DCWorkflow/DCWorkflow.py:1.38	Wed Mar 16 06:09:47 2005
+++ Products/DCWorkflow/DCWorkflow.py	Tue Apr 26 11:36:59 2005
@@ -247,7 +247,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.
@@ -259,7 +259,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
 
@@ -279,7 +279,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)
 
@@ -393,11 +393,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