[Zope-CMF] Workflow: Multiple Workflows per Object?

Florent Guillaume fg@nuxeo.com
Thu, 26 Sep 2002 16:28:56 +0000 (UTC)


Chris Withers  <chrisw@nipltd.com> wrote:
> It appears that the Workflow tool is designed to cater for multiple workflows 
> per object in that you can put a comma seperated list of workflows for each type.
> 
> How is this supposed to work?

After the object is fully created and has received its portal_type, the
TypesTool calls ob.notifyWorkflowCreated() which calls
portal_workflow.notifyCreate(ob) which inserts the object into its
relevant workflow.

> What I'd like to do is have one 'main' workflow per object and also a 
> 'create_subobjects' workflow that creates any automatically generated subobjects 
> of the content being created.
>
> This seemed like a good way to get around the "Scriptable Type Info creation 
> script is executed when content still doesn't know what type it is" problem.

Well it works but is a bit of a hack.

The fundamental problem you have is that you'd like a hook to be called
just after full CMF object creation. There should be one, and I'll add
one to CVS when I have the time (it's easy, in _finishConstruction).

But in the meanwhile it's probably simpler to overload
notifyWorkflowCreated in your product:

    def notifyWorkflowCreated(self):
        MyProduct.inheritedAttribute('notifyWorkflowCreated')(self)
        # now do post-creation stuff
        # ...


HTH,

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com