[ZODB-Dev] afterCommitHook ?
Alexandre Garel
alex.garel at tarentis.com
Fri Aug 24 08:16:10 UTC 2012
Le 24/08/2012 08:52, Sylvain Viollon a écrit :
> (sniped)
>> I've come across references (eg http://bit.ly/NouF1e) to a
>> afterCommitHook but I can't find any documentation to it - can anyone
>> point me at some ?
>>
> There isn't much documentation on a site, as far as I know, but you can start
> by going in the ZODB code and read in the interfaces.py files the docstring of the
> interfaces, that defines the API. There is lot of information to be found there.
>> I also heard a reference (in a YouTube video) to a 'hook which monitors
>> objects coming out of ZODB to determine if they match the current
>> version' (I'm paraphrasing a bit but that what they meant). I wasn't
>> sure if this referred to a feature of ZODB or whether the person meant
>> hooking into a standard python method - any ideas on that one ?
>>
> I think he meant this method on the transaction object (that you can get with
> transaction.get):
>
> def addAfterCommitHook(hook, args=(), kws=None):
>
>
> You will find more information about this method in the interfaces.py file of the
> transaction package.
A link to the file, in case :
http://svn.zope.org/transaction/trunk/transaction/interfaces.py?rev=123062&view=markup
Just a thing to be aware. afterCommitHooks are called only on commit. On
abort, they are not called. If you want to have a hook called after
either commit or abort, you may use an ISynchronizer and registerSynch.
Hope this helps,
Alex
--
Alexandre Garel
06 78 33 15 37
More information about the ZODB-Dev
mailing list