[ZODB-Dev] Re: [Zope-Checkins] CVS: ZODB/src/ZODB - ZApplication.py:1.14

Jeremy Hylton jeremy at alum.mit.edu
Fri Apr 16 11:38:11 EDT 2004


On Fri, 2004-04-16 at 11:07, Shane Hathaway wrote:
> I'm quite surprised by this change.  Since the name "transaction" refers 
> to a module, something is required to guess that transaction.commit() 
> should commit "conn".  One way to make that guess is to bind 
> transactions to threads, but why guess?  With 
> conn.getTransaction().commit(), at least there was no need to guess.

The use of getTransaction() only makes a difference if
setLocalTransaction() was called first.  Since it wasn't called in this
code, then conn.getTransaction() would in turn call transaction.get().
In theory, the connection could be bound to a different transaction --
but only if you ignore the call to db.open() just two lines above.

We've started revising the transaction API as described in the Wiki page
I posted several weeks ago.  One of the changes there was to introduce
explicit transaction managers, which manage the association between
connections and transactions.  If we wanted to avoid the implicit one
thread, one connection policy, we could pass a transaction manager to
db.open() and call the TM's commit() method.

Jeremy






More information about the ZODB-Dev mailing list