[Zope-CMF] Forcing a workflow state

Christian Scholz cs at comlounge.net
Tue Jan 24 16:59:07 EST 2006


Hi!


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

I once found some piece of code in the ATCT migrator once:

def migrate_workflow(self):
        """migrate the workflow state
        """
        wfh = getattr(self.old, 'workflow_history', None)
        if wfh:
            wfh = copyPermMap(wfh)
            self.new.workflow_history = wfh

I'd say that you might look into what workflow_history looks like. AFAIK 
the review_state is actually just the last entry in this and not 
separately saved.

-- christian




More information about the Zope-CMF mailing list