[ZDP] BackTalk to Document Zope Developer's Guide (2.4 edition)/ZODB Persistent Components

nobody@nowhere.com nobody@nowhere.com
Fri, 16 Aug 2002 03:48:56 -0400


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZDG/current/Persistence.stx#2-42

---------------

    Because Zope does transaction management for you, most of the time you
    do not need to explicitly begin, commit or abort your own
    transactions.  For more information on doing transaction management
    manually, see the links at the end of this chapter that lead to more
    detailed tutorials of doing your own ZODB programming.

      % Anonymous User - Jan. 4, 2002 9:14 am - The text should probably mention that you have to let the exception propagate "right out of Zope" for the "rollback" to occur in Zope (of course). Otherwise, it seems to be the case that if the exception is to be handled within a Zope Product (so that a user of the application doesn't see the standard error page), then an explicit transaction abort should be performed in the exception handler in question.

      % peterb - Aug. 16, 2002 3:48 am:
       It should be even more specific and mention that if the exception is caught, whether in a product, in DTML or
       in a script there is no automatic rollback.
       You need to call get_transaction.abort() in your exception handler, unless you rethrow the exception and you
       know it won't get caught.
       This is actually guesswork due to lacking docs, I just happen to have the problem right now.