From 5179bbf9ebcbd091cd3082858a72b76fad93e086 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 27 Oct 2008 18:53:36 +0100 Subject: check for db errors --- index.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.py b/index.py index 813e79b..f6e08e1 100644 --- a/index.py +++ b/index.py @@ -46,7 +46,11 @@ def closedb(req): # start a new session and context and register the session dictionary in our # global template context def session_start(req, anonymous): - req.dbc = MySQLdb.connect(host="localhost", user="apache", passwd="password", db="trac") + try: + req.dbc = MySQLdb.connect(host="localhost", user="apache", passwd="password", db="trac") + except: + redirect(req, "db_error") + req.cursor = req.dbc.cursor() req.register_cleanup(closedb, req) -- cgit v1.2.3