[Zope] Newbie: db handling question

Dieter Maurer dieter at handshake.de
Thu Dec 4 16:23:49 EST 2003


fowlertrainer at anonym.hu wrote at 2003-12-4 13:55 +0100:
>  As you write in this week, the DA is commit/rollback automatically.
>  If an error occured, the zope shows it's error page, and I can
>  redefine it.
>  This way is good to the normal web pages, but not too good for
>  others.

When you are working with a relational database, you are using
in fact at least 2 databases: the ZODB and your relational database.
When you are using sessions, you get another database (the one
hosting your sessions). You must maintain all these databases
in a consistent state in case of errors.

I *STRONGLY* recommend to use Zope's standard transaction
behaviour and not to catch exceptions that may have modified
persistent state (whether in an external database, the main ZODB
or the session ZODB).


If you *really* do not want to follow my advice,
you may have a look at my "emulatedRedirect" External Method.
It shows you how to abort Zope transactions (including those
of all related databases).

  <http://www.dieter.handshake.de/pyprojects/zope>


-- 
Dieter



More information about the Zope mailing list