home contents changes options help subscribe edit (external edit)

Make Transaction Hooks Behave As Documented

Authors: Christian Zagrodnick <cz@gocept.com>
Status: Draft

Current state

The documentation in the _transaction.py reads:

Sometimes, applications want to execute code after a transaction is committed or aborted. [...]? The callable will be called with a Boolean value representing the status of the commit operation as first argument (true if successfull or false iff aborted) [...]?

And indeed in the commit() method it reads:

try:
    self._commitResources()
    self.status = Status.COMMITTED
except:
    t, v, tb = self._saveAndGetCommitishError()
    self._callAfterCommitHooks(status=False)
    raise t, v, tb
else:
    if self._manager:
        self._manager.free(self)
    self._synchronizers.map(lambda s: s.afterCompletion(self))
    self._callAfterCommitHooks(status=True)

But in the abort() method the hooks are not called.

Proposed Solution

Call the afterCommit hooks with False as argument on abort.



subject:
  ( 11 subscribers )