diff options
-rw-r--r-- | index.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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) |