[Zope-CMF] DCWorkflow, scripts and multiple workflows

Florent Guillaume fg@nuxeo.com
Thu, 16 May 2002 18:17:56 +0000 (UTC)


Sion Morris  <s.morris@bangor.ac.uk> wrote:
> Does anyone have any examples of using scripts with DCWorkflow? 
> Searching the CMF site and the internet came up with nothing.

Here's a simple transition script:

##parameters=state_change
object = state_change.object
arg = 'main'
keys = state_change.kwargs.get('keys', [])
object.someMethod(arg, keys)

Here's a script 'transition_guard' called from a guard:
Guard Expression: python: scripts.transition_guard(state_change, 'publish')

##parameters=state_change, transition
object = state_change.object
ok = object.checkTransitionOk(transition)
return ok

Here's a script 'get_variable' called from a variable:
Default expr: python: scripts.get_variable(state_change, 'Categories')

##parameters=state_change, var
object = state_change.object
return object.getWorkflowVariable(var)


You get the idea. Check in the doc/ directory of DCWorkflow for
the namespaces.

> If I create a document type of "minutes", which is pretty 
> generic, can I associate different workflows depending on what the 
> subject matter of the minutes is?

You cannot do that with standard WorkflowTool. Workflows are fixed and
base on the object's Portal Type.

I have a simple extension that would allow you to do that, it's nearly
ready for release.

Florent

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