[ZODB-Dev] API for dooming a transaction for ZODB 3.3
Casey Duncan
casey at zope.com
Thu Jan 8 09:39:20 EST 2004
On Thu, 08 Jan 2004 16:18:30 +0200
Steve Alexander <steve at z3u.com> wrote:
> Hi,
>
> I'd like to add some sort of API for dooming a transaction to ZODB
> 3.3.
>
> Dooming a transaction is a way of ensuring that a transaction will not
>
> successfully commit, without actually aborting the tranaction
> immediately.
>
> This is particularly useful in Zope applications when an error occurs
> in an application, and you want to ensure the transaction will not be
> committed, but you don't want to present the exception to the user.
This is probably a fair bit less useful now that MVCC is in play, but I
believe there are still cases where you may want writes in a transaction
to fail without preventing reads. IOW you want the transaction to fail
only if a write is performed, but if no writing is done then everythings
ok. At the time the transaction is "doomed" you will not need to know
whether a write will occur further down the line or not.
Assuming you call "doom()" what happens when "commit()" is subsequently
called, an exception? I would argue yes if persistent objects have
changed, no otherwise. However I don't think this fulfils your use case
to not present errors to the user. I guess the alternative is to make
"commit()" actually abort the transaction silently, but that sounds a
bit dubious.
I like the name though ;^)
-Casey
More information about the ZODB-Dev
mailing list