This is an attempt to associate zodb transactions on a per connection basis. the major benefits is by disassociating the transaction to thread association we can have multiple connections in a single thread and hence multiple dbs open while maintaining per connection transaction integrity.
Application code can continue to use get_transaction().register(ob) as long as ob is a persistent object or a zodb connection. Application code that tries to integrate non-persistent objects for transactional control needs to call get_transaction() with a persistent object or connection as an arg so that it can be registered with an appropiate connection.
Transitioning between transaction states cannot be done via get_transaction(), a persistent object or connection must be passed in so the proper transaction is returned.
basically use of the full range of ZODB features (ie Zope) will not work.
otoh, most basic and common usages as a POS will probably work.
multi-threaded code shouldn't have share connections, its probably better for such code to use and return conns to the db as needed.
import this module and call the install_free_txn function, which will hotpatch the connection and transaction classes and install the get_transaction accessor in globals.
i did some basic tests. if it breaks you get to keep both pieces
Zope Public License (ZPL) ZPL 1.0 or a later version of the ZPL at your discretion.
author: kapil thangavelu