Newbie: db handling question
Hello , 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. If I want catch these errors, and show, then two problem I get: try: apply set error=0 except: set error=1 The html page is structured to when error is 1, then it is show normal page with little red errormessage - and it's don't use zope's error page. - In this case I catch the exception, but because not raised again, the DA transaction is committed, not rollbacked. It is wanted to call the rollback directly. - I don't have the exception's errormessage, only if I use traceback module. Can I use that normally in threaded app like Zope ? Thanx for any answers !!! And thanx for answers before this email. -- Best regards, fowlertrainer mailto:fowlertrainer@anonym.hu
fowlertrainer@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
participants (2)
-
Dieter Maurer -
fowlertrainerļ¼ anonym.hu