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

yuppie y.2009 at wcm-solutions.de
Wed Feb 18 15:35:51 EST 2009


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.

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

If the subscriber for IObjectCopiedEvent removes the workflow_history 
everything seems to work fine.



More information about the Zope-CMF mailing list