Hi Tres,

Looks farily good overall.  I think one useful extension would be useful
to provide access to the same information currently exposed via
Products.DCWorkflow.Expression.StaTeChangeInfo (these are what the
guard expressions use):

  - The workflow object itself.

  - The transition object itself

  - The history of the object

  - Any keywords passed to the transition-trigger ('doActionFor')

Naming those attributes with the same names used in the expression
context might make porting some scripts / guard expressions to event
handlers simpler.

Right. I just passed the names in to keep things simple, but we could
just as easily pass in the tdef, old_sdef, new_sdef.

For the kwargs, we could pass those along from the function (def
_executeTransition(self, ob, tdef=None, kwargs=None)).

When you say history, do you mean former_status in that function
(former_status = self._getStatusOf(ob))? They would of course be easy to
move over.

For full generality, we also need to allow the "before" handlers to veto
the transition, e.g. by raising WorkflowException.  Looking at the code,
it doesn't appear that the definition or the tool make any effort to
catch exceptions raised by transition scripts, so we should just emulate
how it handles them.

Meaning, we don't need to do anything more?

Let me try to refactor as you say and post a new patch.


Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to