Alex Clark wrote:

Hi Alex,


On 2009-03-12, Hedley Roos <[email protected]> wrote:
I would use an event subscriber:

   <subscriber
     for="Products.todo.content.interfaces.ITodo
          Products.DCWorkflow.interfaces.IAfterTransitionEvent"
     handler=".events.afterTransitionTodo"
   />

def afterTransitionTodo(todo, event):
   wf = getToolByName(todo, 'portal_workflow')
new_state = wf.getInfoFor(todo, 'review_state') # xxx: the state is probably if the event parameter, not sure
   for obj in todo.getFolderContents(full_objects=True):
     obj.doActionFor(obj, new_state)

This is great! Thanks, Hedley (and all, for the replies).

I'm very close but hitting some annoying roadblock, any thoughts on:
    - http://paste.plone.org/27262

With code:
    - http://tinyurl.com/chm3f9

Looking at this I just noticed the following:

[..]
    review_state = wf.getInfoFor(todo, 'review_state')
    path = todo.absolute_url_path()

    for brain in catalog.searchResults(path=path, portal_type='Todo item'):
        obj = brain.getObject()
        obj_path = obj.absolute_url_path()
        old_state = event.old_state.getId()
log('Changing workflow state on %s from %s to %s.' % (obj_path, old_state, review_state))
        wf.doActionFor(obj,review_state,wf_id='todo_list_workflow')
[..]

Note that you are passing a review *state* to 'doActionFor'
whereas you are supposed to specify a *transition*.

Raphael



?

I'm starting to suspect my workflow is broken, after poking around
Module Products.DCWorkflow.DCWorkflow, line 283, in doActionFor
it raises:
    raise WorkflowException(_(u'Object is in an undefined state.'))
which makes no sense to me.

Hedley



_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to