[Zope-CMF] Getting state title in DCWorklow

Florent Guillaume fg@nuxeo.com
17 Nov 2001 00:42:57 GMT


> I built a workflow using symbolic names for states instead of the full 
> description I wanted to display.  The full description is in the states' 
> titles.
> Is there any non-python-product way to retrieve that?  (Currently I'm 
> getting the state name with getInfoFor(container, 'state', '').)

If you're using a DCWorkflow 0.4:

Create a new variable called 'state_title' and give it a default
expression of:
	python: workflow.states[status['review_state']].title
(urgh, not pretty)
Then to retrieve it use:
	portal_workflow.getInfoFor(context, 'state_title')


Hmmm general question : any reason the Expression context is very
transition-oriented and not state-oriented ? 

In getCatalogVariablesFor and in getInfoFor we create an Expression
context which (obviously) has no transition info. It would be useful in
this situation to bind a variable like 'state', to be able to access the
current state. Should I write a patch ?

(The answer to the problem at hand would then be written
getInfoFor(context, 'state').title, assuming no permission problem.)


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