[Zope-CMF] Re: DCWorkflow using workflow variables in guards
Riccardo Lemmi
riccardo at reflab.it
Tue Aug 19 12:32:36 EDT 2003
mvans at xs4all.nl wrote:
>> mvans at xs4all.nl wrote:
>>> hi all,
>>>
>>> Im trying to make a workflow that is able to assign an object to a
>>> person
>>> instead of a role. I'm trying to accomplish this by setting a workflow
>>> variable 'assigned' and doing checks on this variable in the guard
>>> conditions.
>>>
>>> I read the docs that are available. and came to the following guard
>>> conditions to reference the variable with python expressions.
>>>
>>> python:status_change.state.assigned == 'somename'
>>> This does not work.
>>>
>>> python:state.assigned == 'somename'
>>> this also doesn't work.
>>>
>>> Does anyone has any ideas how to accomplish this?
>>
>> In the transition where you assign the assigned variable also change
>> ownership (by using a script) of the object to that user, then in the
>> guard use "Role(s)=Owner".
>> In order for the object to show up in the worklist for that user, you
>> have to add a catalog variable for "assigned" and then match that to
>> "%(user_id)s".
>>
>> BEWARE: it's been a while I hadn't time to work on zope/cmf/plone, so
>> things may have changed and there could be a simpler/better way to
>> achieve the same result.
>>
>> Bye
>> --
>> Luca Olivetti
>> Wetron Automatización S.A. http://www.wetron.es/
>> Tel. +34 93 5883004 Fax +34 93 5883007
>>
>>
>
> Thanks Lucia,
>
> I will try it like that.
>
> But do you happen to know how to access a workflow variable from the guard
> condition?
>
> I tried
> python:status_change.state.assigned == 'somename'
> python:state.assigned == 'somename'
>
> I know I can access the 'state' object like this, but I'm not able to
> access the assigned variable
>
> Any help apreciated
>
> Cheers,
> Michael
>
Try this:
python:state_change.status.get('assigned','')
--
Riccardo Lemmi
More information about the Zope-CMF
mailing list