[Zope-CMF] Updating workflow variables from within scripts

Florent Guillaume fg@nuxeo.com
20 Mar 2003 21:15:14 +0100


On Thu, 2003-03-20 at 21:02, Adam Fields wrote:
> On Thu, Mar 20, 2003 at 08:11:54PM +0100, Florent Guillaume wrote:
> > Yes I'd increment a variable in the transition looping back to the
> > initial state. To increment a var you'd use something like (see more doc
> > in doc/expressions.stx):
> >    python:status.myvar + 1
> > 
> > (DCWorkflow.Expression.createExprContext has the full expression context
> > definition if the doc is not enough.)
> 
> Thanks, I'll try that.
> 
> > > 2) When a child object completes its workflow, I'd like to have it set
> > >    a flag in its parent object telling it that the content contained
> > >    within is ready. So, for example, if I have an article and an
> > >    image within it, I'd like for the article to know whether the image
> > >    is "done" or not.
> > 
> > The child could provoke a given transition on the parent that changes a
> > variable.
> 
> I'm not clear on the mechanism to invoke a transition in another
> workflow. Can you elaborate on that some more? Do you mean something
> like what happens in content_status_modify (which is the only
> mechanism by which I've been able to execute a transition, other than
> automatic triggers)?

Yes, doActionFor. Portal_workflow only has three public methods, one of
which is doActionFor(ob, action). 'action' is the transition id. If the
transition doesn't have a title field, it won't appear in
getActionsFor() thus in the GUI, but it's still available to python
code.

Florent

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