[Zope3-dev] substransactions and beforeDelete
Jim Fulton
jim at zope.com
Wed Jan 7 11:39:32 EST 2004
Steve Alexander wrote:
>
>>> Why are you catching the exception?
>>
>>
>> Because I want to display a nice message to the user. If I don't catch
>> the exception, it will go up to the Publisher that will display a
>> not-nice error message. Hm are you suggesting I could provide a custom
>> error message for that particular exception? That could work, but I
>> would have like the flexibility of catching the exception from normal
>> skin code and display my error message there.
>
>
> Jim already mentioned a customised view on the exception.
>
> Another option that is not as architecturally clean, but might work
> better for you, is to catch the exception, but doom the transaction.
>
> I wonder if it's a good idea to support having an application say "I
> want to doom this transaction", and have the publication object just
> abort that transaction without returning an error page.
Thats fine. Just call get_transaction().abort(). You just want to
make sure that there isn't any other code doing work you don't know
about.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list