# HG changeset patch # User Aurelien Campeas # Date 1259836771 -3600 # Node ID cc29eddf51ad173ed8d30d0bb05d6af95d25e2a6 # Parent d5bf894fcf02359bb07de443ca4480f8c3fd8676 add postcommit_event on Operations diff -r d5bf894fcf02 -r cc29eddf51ad entities/wfobjs.py --- a/entities/wfobjs.py Thu Dec 03 10:02:44 2009 +0100 +++ b/entities/wfobjs.py Thu Dec 03 11:39:31 2009 +0100 @@ -426,6 +426,7 @@ def possible_transitions(self, type='normal'): """generates transition that MAY be fired for the given entity, expected to be in this state + used only by the UI """ if self.current_state is None or self.current_workflow is None: return diff -r d5bf894fcf02 -r cc29eddf51ad server/pool.py --- a/server/pool.py Thu Dec 03 10:02:44 2009 +0100 +++ b/server/pool.py Thu Dec 03 11:39:31 2009 +0100 @@ -191,7 +191,7 @@ return -(i + 1) def handle_event(self, event): - """delegate event handling to the opertaion""" + """delegate event handling to the operation""" getattr(self, event)() def precommit_event(self): @@ -222,6 +222,9 @@ operation list """ + def postcommit_event(self): + """the observed connections pool has committed""" + class PreCommitOperation(Operation): """base class for operation only defining a precommit operation diff -r d5bf894fcf02 -r cc29eddf51ad server/session.py --- a/server/session.py Thu Dec 03 10:02:44 2009 +0100 +++ b/server/session.py Thu Dec 03 11:39:31 2009 +0100 @@ -467,6 +467,15 @@ self.rollback(reset_pool) raise self.pool.commit() + self.commit_state = trstate = 'postcommit' + while self.pending_operations: + operation = self.pending_operations.pop(0) + operation.processed = trstate + try: + operation.handle_event('%s_event' % trstate) + except: + self.exception('error while %sing', trstate) + self.debug('%s session %s done', trstate, self.id) finally: self._touch() self.commit_state = None