[Zope-CMF] Accessing workflow variables

Florent Guillaume fg@nuxeo.com
Wed, 16 Oct 2002 18:59:53 +0200


In DCWorkflow in general, here.portal_workflow.getInfoFor(here,'locked')
is the correct way to access a workflow variable.

However in CPS 2.0, the 'locked' variable is a stray one, it's not used.
In CPS to know if an object is locked, call here.is_locked(). There is
also is_archive, is_draft, is_stable, is_checkin_allowed,
is_checkout_allowed that you can call.

We don't use workflow variables for that for various reasons, one of
them being speed.

If you want to lock or unlock an object by hand, you have to call
become_locked or become_stable, but these are not available from
restricted code.

The only available functions from restricted code are check_in,
check_out and abandont_draft.

Florent

In article <20021016154351.37473.qmail@web21401.mail.yahoo.com> you write:
> Hello,
> 
> I'm trying to access a workflow variable called
> locked.
> (For those of you who work at Nuxeo, I dropped your
> VersionManager product and did an export/import of the
> version_support workflow from the CPS into my zope
> instance).  Basically, I'm trying to figure out how to
> "lock" a document.  I'm using a ZPT to try and access
> this but I'm not getting any luck.  Am I required to
> index the variable before I can get or set it? 
> 
> Here's the code I'm using: 
> 
> <span tal define="myvar
> python:here.portal_workflow.getInfoFor(here,'locked')"></span>
> <span tal content="myvar">Actions</span>
> 
> Basically, myvar is empty.  Also, is there a way to
> dump all of the variables defined in the
> portal_workflow tool?  i've tried using the
> getCatalogVariablesFor() method, but that just returns
> a  security error saying that the method is "private"
> and that I'm not authorized to access it data. 


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