[ZPT] Using on-error allows transaction to commit?
Dieter Maurer
dieter@handshake.de
Thu, 13 Sep 2001 22:51:30 +0200 (CEST)
Brent Hendricks writes:
> ...
> The exception causes Zope to abort the transaction and all
> is well with the world....except that I'd like to detect this error
> and print a nice message to the user explaining what to do. I figured
> that tal:on-error would be a good way to do it. The problem is that
> when on-error catches the exception, Zope no longer aborts the
> database transaction.
>
> I tired catching the exception myself in the python script and
> manually calling get_transaction().abort() but get_transation()
> doesn't seem to be defined for python scripts. I suppose I could try
> putting that in my external method, but that just seems like the wrong
> place to do it.
Your options:
* do it in an External Method (as you explained above)
* customize the error handling page to recognize your
exception and provide adequate explanatory text.
Dieter