[Zope-CMF] Raising a WorkflowException

Dan Fairs monster at spiderplant.net
Tue Sep 7 05:49:59 EDT 2004


Hi,

I asked this on plone-users, and haven't had a reply... on reflection it's
probably better on the CMF list.

I'm using Plone and DCWorkflow, and am doing some extra validation of
fields in a workflow script (I'm using AT schemata so just want to
validate everything at the end, as the user submits their content for
review). I'm having a problem with what to do when my custom validation
fails, and I want to roll back the transition.

According to the documentation, you can raise
state_change.WorkflowException to roll back a transition if you're not
happy. When I try this, I get an AttributeError (StateChangeInfo doesn't
have a WorkflowException attribute). This is true enough - I looked in
Expressions.py in DCWorkflow, and there's no WorkflowException (I was
expecting to see it next to the assignments of ObjectMoved).

If I raise CMFCore.WorkflowCore.WorkflowException directly, it bubbles all
the way to the surface and I get a SiteError.

How can I abort a transition 'neatly'? Things like
state_change.ObjectMoved work fine.

Cheers,
Dan




More information about the Zope-CMF mailing list