On 3 March 2013 08:37, Carlos de la Guardia
<carlos.delaguar...@gmail.com> 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):
...         pass
...
KeyboardInterrupt
>>> class MySynch(object):
...     def newTransaction(self, transaction):
...         print "New transaction"
...     def beforeCompletion(self, transaction):
...         print "Commit started"
...     def afterCompletion(self, transaction):
...         print "Commit finished"
...
>>> import transaction
>>> synch = MySynch()
>>> transaction.manager.registerSynch(synch)
>>> tx = transaction.begin()
New transaction
>>> tx.commit()
Commit started
Commit finished

If you want a singleton synchronizer then you can use classmethods
everywhere, but you'll still need to implement them all.

Laurence

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to