[Zope-CMF] Forcing a workflow state

Jens Vagelpohl jens at dataflake.org
Tue Jan 24 14:58:14 EST 2006


On 24 Jan 2006, at 19:36, Martin Aspeli wrote:

> Hi guys,
>
> 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.

You'll probably have to construct the dictionary that describes the  
state/comment/transition time etc yourself 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.

jens



More information about the Zope-CMF mailing list