def notifyBefore(self, ob, action): """ Notify all applicable workflows of an action before it happens. """ wfs = self.getWorkflowsFor(ob) for wf in wfs: wf.notifyBefore(ob, action) notify(ActionWillBeInvokedEvent(ob, wf, action))
def _invokeWithNotification(self, wfs, ob, action, func, args, kw): """ Private utility method: call 'func', and deal with exceptions indicating that the object has been deleted or moved. """ reindex = 1 for w in wfs: w.notifyBefore(ob, action) notify(ActionWillBeInvokedEvent(ob, w, action)) try: res = func(*args, **kw) except ObjectDeleted, ex: res = ex.getResult() reindex = 0