eventsploneplone-3.x

Doing a raise while Products.CMFCore.interfaces.IActionSucceededEvent is being executed is going to abort the ZODB transaction for the workflow?


Suppose I have mynamespace.myproduct:

 <subscriber for="..interfaces.myinterface.IMyInterface
                  Products.CMFCore.interfaces.IActionSucceededEvent" 
            handler=".handlers.actionSucceeded" 
    /> 

and mynamespace.myproduct2:

 <subscriber for="..interfaces.myinterface.IMyInterface
                  Products.CMFCore.interfaces.IActionSucceededEvent" 
            handler=".handlers.actionSucceeded" 
    /> 

(the handlers do different stuff, on each product, even if they have the same name on this example)

I have a custom type that has a custom workflow. I'm going to do a workflow transition from Python, using doActionFor, and do a bunch of things when IActionSucceededEvent is triggered.

My question is: if I raise an exception on any of .handlers.actionSucceeded if an error occurs, will the doActionFor call be reverted (even after IActionSucceededEvent was run)? If not, if I use IActionWillBeInvokedEvent, will I be able to accomplish my goals? Will I have a problem for having two different products, both using Products.CMFCore.interfaces.IActionSucceededEvent for the same ..interfaces.myinterface.IMyInterface interface?


Solution

    1. Yes, if you raise any exception in one of your handlers the entire transaction will fail and it will be reverted
    2. no, you wouldn't have problems using more than one subscriber for the same interfaces. They would be execute in order of registration.
    3. no, using IActionWillBeInvokedEvent will not help. It's fired before wf transition, but if you raise exceptions the transaction will fail anyway.