[Zope-CMF] Getting state title in DCWorklow

Jeffrey P Shell jeffrey@cuemedia.com
Fri, 16 Nov 2001 18:55:36 -0700


On Saturday, November 17, 2001, at 12:42  AM, Florent Guillaume wrote:

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

Because (I believe), the changes to the status occurs on 
transitions.  For example, I've been working on a rather complex 
task/project/billing system and have written two custom workflows 
(both in Python).  Some of the "internal" states can be repeated - 
a task can go from "In Progress" to "In Progress".

Having the status memory on the transitions allows me to have a 
history where a user can basically add continue to add comments 
while keeping the object in the "In Progress" state.

The transitions can host lots of interesting information - the 
actor, the time the transition was done, etc.  You can't really 
relate this to State itself. ie - "Jeffrey set the task to 
Cancelled at 4:25 pm"

I hope this message makes some sense.  I've had my brain tied in 
knots for most of the week working on these workflows (but I do 
have some pretty diagrams to show for it!) and am ready to go home 
and gaze longingly at my skis and pray for snow.

Jeffrey P Shell, jeffrey@cuemedia.com