[ZODB-Dev] Re: afterCommitHook on abort
Christian Zagrodnick
cz at gocept.com
Tue Sep 4 11:40:17 EDT 2007
Any opinion about this?
On 2007-08-30 15:48:53 +0200, Christian Zagrodnick <cz at gocept.com> said:
> Hi,
>
> the documentation in the _transaction.py reads:
>
> After-commit hook
> ------------------
>
> 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.
>
> Is this intentional? If yes, the documentation should be adjusted to
> reflect that the hooks are *only* called if there *is* a commit and it
> is *failing*.
>
> If not the hooks should be called in abort (my favourite) :)
>
>
> Regards,
--
Christian Zagrodnick
gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891
More information about the ZODB-Dev
mailing list