[ZODB-Dev] Re: Webkit Threading and ZODB 3.3a2: problems on Windows

Casey Duncan casey at zope.com
Fri Feb 20 10:58:58 EST 2004


On Thu, 19 Feb 2004 17:44:38 -0500 (EST)
Shane Hathaway <shane at zope.com> wrote:

> On Thu, 19 Feb 2004, Matt Feifarek wrote:
> 
> > I'm not sure I understand, no changes are EVER made before sleeping 
> > without a commit. But here's a better re-cap of what I DO
> > understand:
> > 
> > 1. A servlet either exists, or is instantiated
> > 2. As a part of it's building of state, it gets a database
> > connection, and then a handle on an object in the db
> > 3. If no changes are made to the object, no
> > get_transaction().commit() is run
> >        (we know if changes are made, with good certainty)
> > 4. If changes ARE made, we do call get_transaction().commit()
> 
> As a sanity check, you might consider calling
> get_transaction().commit() every time.  If there have been no changes,
> it does no harm.  Alternatively, you can call
> get_transaction().abort() if no changes were intended.  A third
> alternative is to assert that get_transaction()._objects is empty when
> you made no changes (although that's not a public API.)

Hmm, maybe a get_transaction().ismodifed() method that returned True if
there were changes made in the transaction would be useful as a public
API?

Or, a crazier idea, may the transaction object should be iterable (or
have a method that returns an iterator) of the modified objects in the
transaction?

-Casey




More information about the ZODB-Dev mailing list