[Zope-DB] Re: gadlfy/commit
Dieter Maurer
dieter@handshake.de
Wed, 12 Jun 2002 19:06:39 +0200
Dennis Allison writes:
> ...
> The database-operation raises a non-unique key exception so control passes
> to the <dtml-except>. The database is updated (non-unique keys be damned).
> >From what you write, the <dtml-except> block has to raise and exception to
> cause a rollback. That means the pattern is:
>
> <dtml-try>
> <dtml-try>
> database-operation
> <dtml-except>
> <!-- here for exception for the operation -->
> raise some-exception
> </dtml-try>
> <dtml-except>
> <!-- report the problem -->
> </dtml-try>
>
> which seems a bit ugly, but if that's how it's done....
You can use "raise type=Redirect" to get the transaction aborted
and be redirected to the content of the "raise" tag.
An alternative might be my External Method "emulateRedirect".
It provides for transaction control.
<http://www.dieter.handshake.de/pyprojects/zope>
Dieter