Re: transaction: getting hooks and synchronizers to work

2013-03-03 Thread Laurence Rowe
On Sunday, March 3, 2013 4:59:58 PM UTC-8, Sid K wrote: > > Ok, it looks like the synchronizer instance needs to remain in the calling > scope for the synchronizer to work. This code (Laurence) works: > > synch = MySynch() > transaction.manager.registerSynch(synch) > > while this code (what we w

Re: transaction: getting hooks and synchronizers to work

2013-03-03 Thread Siddhartha Kasivajhula
Ok, it looks like the synchronizer instance needs to remain in the calling scope for the synchronizer to work. This code (Laurence) works: synch = MySynch() transaction.manager.registerSynch(synch) while this code (what we were doing earlier) doesn't: transaction.manager.registerSynch(MySynch())

Re: transaction: getting hooks and synchronizers to work

2013-03-03 Thread Laurence Rowe
On 3 March 2013 08:37, Carlos de la Guardia wrote: > Laurence, did you get it to work like that? I tried before using > classmethod and wasn't able to make it work. Ah, you need to implement all methods on ISynchronizer: >>> class MySynch(object): ... def newTransaction(self, transaction): .

Re: transaction: getting hooks and synchronizers to work

2013-03-03 Thread Carlos de la Guardia
Laurence, did you get it to work like that? I tried before using classmethod and wasn't able to make it work. Carlos de la Guardia > Pass an instance of the MySynch class rather than the class itself, e.g: > > class MySynch(object): > def beforeCompletion(self, transaction): > print

Re: transaction: getting hooks and synchronizers to work

2013-03-03 Thread Laurence Rowe
On Sunday, 17 February 2013 22:54:30 UTC-8, cguardia wrote: > Hi, > > there were some problems with the code snippets in the book. I updated > them here: > > http://zodb.readthedocs.org/en/latest/transactions.html#before-commit-hooks > > For some reason I could only get synch to work using cla

Re: transaction: getting hooks and synchronizers to work

2013-02-19 Thread Siddhartha Kasivajhula
Carlos, great, thanks for the corrections. They appear to be working now :) On Sun, Feb 17, 2013 at 10:54 PM, Carlos de la Guardia < carlos.delaguar...@gmail.com> wrote: > Hi, > > there were some problems with the code snippets in the book. I updated > them here: > > http://zodb.readthedocs.org/

Re: transaction: getting hooks and synchronizers to work

2013-02-17 Thread Carlos de la Guardia
Hi, there were some problems with the code snippets in the book. I updated them here: http://zodb.readthedocs.org/en/latest/transactions.html#before-commit-hooks For some reason I could only get synch to work using classmethod. Carlos de la Guardia On Sat, Feb 16, 2013 at 3:56 AM, Siddhartha K