summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@dev.spline.de>2008-10-27 18:53:36 +0100
committerroot <root@dev.spline.de>2008-10-27 18:53:36 +0100
commit5179bbf9ebcbd091cd3082858a72b76fad93e086 (patch)
tree798fe421ac2221982699c42b2109c46d5073f009
parent236ad4c8dbef414ef29348634fd0a6ccded1a1d6 (diff)
downloaddev-account-5179bbf9ebcbd091cd3082858a72b76fad93e086.tar.gz
dev-account-5179bbf9ebcbd091cd3082858a72b76fad93e086.tar.xz
dev-account-5179bbf9ebcbd091cd3082858a72b76fad93e086.zip
check for db errors
-rw-r--r--index.py6
1 files changed, 5 insertions, 1 deletions
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)