[Zope-CMF] [dev] .zexp imports and notifyWorkflowCreated

Wichert Akkerman wichert at wiggy.net
Wed Feb 18 15:51:06 EST 2009

Previously yuppie wrote:
> Tres Seaver wrote:
> > yuppie wrote:
> >> Moving the notifyWorkflowCreated call from _finishConstruction to the 
> >> IObjectAddedEvent subscriber changed the behavior of .zexp imports: The 
> >> workflow state is now always reset to the initial state. AFAICT that's 
> >> no useful behavior for imports.
> >>
> >> This is caused by the fact that the notifyCreated method of WorkflowTool 
> >> always resets the workflow states.
> >>
> >> Is that a feature or a bug of notifyCreated? Is anybody using 
> >> notifyCreated for resetting workflow states?
> It turned out that CMF itself uses notifyCreated for resetting workflow 
> states :(
> That's how copy and paste resets the workflow state.

Which is argueably a mis-feature: it means you are not just doing a copy
and paste, but a copy, paste and modify.

> >> Where is the best place to fix this? Should IObjectAddedEvent be 
> >> triggered on imports? Should the subscriber call notifyWorkflowCreated 
> >> if the object already has a workflow history? Should 
> >> notifyWorkflowCreated call WorkflowTool.notifyCreated if the object 
> >> already has a workflow history? Should WorkflowTool.notifyCreated call 
> >> notifyCreated of workflows that already have a state? Should 
> >> notifyCreated of workflows keep existing states untouched?
> >>
> >>
> >> AFAICS the easiest way to fix this is changing 
> >> WorkflowTool.notifyCreated, making sure it only calls notifyCreated for 
> >> workflows without a state in the workflow history.
> > 
> > +1.
> This alone will not work.
> Does it make sense to keep old workflow history records after copy and 
> paste? Or can we just remove the complete workflow_history attribute 
> before notifyCreated is called?

In my opinion a copy should produce a full copy, including all state and


Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.

More information about the Zope-CMF mailing list