[ZODB-Dev] Re: afterCommitHook on abort

Julien Anguenot ja at nuxeo.com
Wed Sep 12 09:49:49 EDT 2007


Hi there,

Christian Zagrodnick wrote:
> Any opinion about this?

I guess the documentation was a little bit ahead of the implementation
at the time I did this.

Though, I think the after commit hooks  should be called  in the abort()
method as well as it might be interesting, as I mentioned it in the
documentation, and as well to be consistent with the commit() behavior.

Maybe cleaning up the documentation would be simpler if nobody needs
this feature right now.

Cheers,

	J.

> 
> 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,
> 
> 


-- 
Julien Anguenot | Nuxeo R&D (Paris, France)
Open Source ECM - http://www.nuxeo.com
Nuxeo 5 : http://www.nuxeo.org
Mobile: +33 (0) 6 72 57 57 66

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20070912/8bc150ce/signature.bin


More information about the ZODB-Dev mailing list