[Zope-CMF] Raising a WorkflowException

Florent Guillaume fg at nuxeo.com
Tue Sep 7 07:03:10 EDT 2004


> 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

What documentation says that ?

> 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'?

What do you mean by neatly ? What do you expect to happen ?

> Things like state_change.ObjectMoved work fine.

They work fine because some part of the code takes care to catch it and
do appropriate work. You should do the same with your exception.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 71 59  http://nuxeo.com  mailto:fg at nuxeo.com


More information about the Zope-CMF mailing list