[ZODB-Dev] preventing a transaction from committing within app code

Chris McDonough chrism at plope.com
Wed Sep 8 12:35:19 EDT 2004


On Wed, 2004-09-08 at 12:20, Jeremy Hylton wrote:
> On Wed, 08 Sep 2004 11:38:32 -0400, Chris McDonough <chrism at plope.com> wrote:
> > Is there or should there be an API within ZODB which would allow app
> > code to manually mark a transaction (or a connection) as
> > "uncommittable"?  I have a need for this sort of thing for a variety of
> > reasons (at least I believe I do, I'd like to hear from others that also
> > think they do ;-), and one way to do it is to manually insert something
> > into a Connection's _conflicts dictionary (the same thing that
> > Connection._is_invalidated does).  Of course that's wrong and nasty.
> > Any better way?
> 
> I think that it's a bad idea to mark a transaction as uncommitable. 
> Just abort it and be done with it.

You hit the nail on the head 100% with the problem with that below.

>   The problem, then, is in the
> policy of starting a new top-level transaction implicitly.  If Zope
> could arrange so that new transactions were begun explicitly, then
> some actions would fail with the error "no transaction active."

That's a great idea.  That would be a lot better.  I don't know that
it's possible to change the behavior of ZODB to do this now, though. 
Zope itself would likely be fine with it (only a couple places would
need to change), but other apps would likely croak.  Would a config
option be reasonable?

- C




More information about the ZODB-Dev mailing list