[Zope3-dev] Re: [ZODB-Dev] revise transaction API

Marius Gedminas mgedmin at b4net.lt
Tue Jun 15 05:21:14 EDT 2004


On Mon, Jun 14, 2004 at 08:01:25AM -0400, Jeremy Hylton wrote:
> > In one of our systems, I "earmark" all objects changed with an easily
> > queryable "last_changed_time" attribute. It's a lot easier to do this on
> > "the way out" than to wire up __setattr__s on all the objects involved.
> > 
> > The other reason is for simple debugging -- sometimes when looking at a
> > process that does many changes, it's interesting to see how much of the
> > database has been touched. I've used this to study the indexing
> > mechanics in IC, and also when trying to find out at what point certain
> > objects were modified.
> 
> I think this reason alone makes it worthwhile.  ZODB can be a bit
> mysterious at first.  I've seen many people ask, "When I commit
> transaction X, what objects get saved?"  An explicit call -- say
> transaction.get().modified() -- would make the answer unambigious, even
> if it wasn't always obvious why the objects were modified.

+1

I've had some problems with unit tests that forget to call
transaction.abort() and cause unrelated tests to fail later for
inexplicable reasons.  So I added a plugin to the unit testing framework
that checks whether get_transaction()._resources is empty after each
unit test and loudly complains if it is not.

Having an official API for such a check would be nice, as I dislike
using private attributes that are implementation details.

Marius Gedminas
-- 
OK, so you're a Ph.D.  Just don't touch anything.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20040615/84411b3b/attachment.bin


More information about the ZODB-Dev mailing list