[Zope-DB] How to I handle the DataBase Errors ?

fowlertrainer at anonym.hu fowlertrainer at anonym.hu
Wed Jun 30 03:15:08 EDT 2004


Hi !

When I start a webpage that uses many ZSQL methods, and the DataBase 
have been shutted down, I get Zope default error.
But how to I redirect this message to my own error page ?

ok, response.redirect()

but how to I determine that this problem caused by DataBase error ?

I don't want to replace every ZSQL call from:

myrows=context.myzsql(params)

to:

myrows=context.callmyzsqls(context.myzsql,params)

def callmyzsqls(azsql,aparams):
    try:
       result=azsql(params)
    except:
       text=getexceptiontext()    
       response.redirect('/databaseerror')

Thanx for help:
 FT


More information about the Zope-DB mailing list