[Zope-CMF] Re: Forcing a workflow state

2006-01-24 Thread Martin Aspeli

Hi Jens,

On Tue, 24 Jan 2006 19:58:14 -, Jens Vagelpohl  
[EMAIL PROTECTED] wrote:


You'll probably have to construct the dictionary that describes the  
state/comment/transition time etcyourself and then append it at the end  
of the workflow history. At least that's what we've been doing a few 
times for migration scripts. Then you can run the workflow security  
updating methods and recatalog things like

 allowedRolesAndUsers.


Thank you! Do you know of any examples of code doing this?

Cheers,
Martin

--
(muted)

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Re: Forcing a workflow state

2006-01-24 Thread Jens Vagelpohl


On 24 Jan 2006, at 20:40, Martin Aspeli wrote:


Hi Jens,

On Tue, 24 Jan 2006 19:58:14 -, Jens Vagelpohl  
[EMAIL PROTECTED] wrote:


You'll probably have to construct the dictionary that describes  
the state/comment/transition time etcyourself and then append it  
at the end of the workflow history. At least that's what we've  
been doing a fewtimes for migration scripts. Then you can run the  
workflow security updating methods and recatalog things like

 allowedRolesAndUsers.


Thank you! Do you know of any examples of code doing this?


Don't have anything handy right now, it's at work.

jens

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


[Zope-CMF] Re: Forcing a workflow state

2006-01-24 Thread Florent Guillaume

Martin Aspeli wrote:
I'm writing some migration code that needs to force a workflow state. 
That is, a given content item has a workflow with states A, B and C, and 
depending on some external state, I  need to force it to be in state B, 
including having B's security settings.


I've had a look at the API, but it's all very geared towards transitions 
rather than setting states explicitly. Before I resort to pdb, does 
anyone know the relevant part of the DCWorkflow API I should use to 
force a state? I don't mind mucking about with internals, obviously.


Calling portal_workflow.setStatusOf(...) should be enough. You'll have 
to pass a status dict containing at least {wf.state_var: state_id}, you 
should also set the other variables your application expects.


Then update the security mappings by calling wf.updateRoleMappingsFor(ob).


Florent


--
Florent Guillaume, Nuxeo (Paris, France)   Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests