In Products.todo (https://svn.plone.org/svn/collective/Products.todo/trunk)
I have a folderish 'Todo Item' content type that can contain one or more 'Todo Item'(s).
I've just added a workflow that contains states: 'not done', 'done' and when
state
is changed on a todo item with todo items inside of it, I want to change state
for all of those objects.
What is the best way to do that?
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)
Hedley
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers