[ZODB-Dev] API for dooming a transaction for ZODB 3.3

Dieter Maurer dieter at handshake.de
Sun Jan 11 12:39:38 EST 2004


Steve Alexander wrote at 2004-1-10 23:09 +0200:
>Currently, such an application needs to raise an exception. The
>application code assumes that the exception will reach Zope's publisher,
>and that the publisher will treat receiving the exception as a cue to
>abort the transaction and show the error page.
>
>However, if the exception is caught before it reaches the publisher,
>then inappropriate state may be committed, as the publisher will have no
>reason to abort the transaction.
>
>So, I think the doom API would be useful in your example. In your
>example, the application should call get_transaction().doom(), and then
>it should raise an exception. If the publisher gets the exception, then
>the transaction will be aborted, and the error page shown. If the
>exception is caught before it reaches the publisher, then the
>transaction still cannot be committed. This is not *ideal*, for the
>application, but it is vastly better than inadvertantly committing bad
>state.
>
>The doom API allows you to ensure that a transaction that should not be
>committed will not be committed.

I would be fully happy, when the request client would get an
error indication, too.
Otherwise, it may seem to him that the transaction were
successful while it was in fact aborted.

-- 
Dieter



More information about the ZODB-Dev mailing list