changeset 42:b2bc08f2974b

try except error on non existing user table
author marcink
date Wed, 07 Apr 2010 13:24:46 +0200
parents 71ffa932799d
children 2e1247e62c5b
files pylons_app/lib/auth.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/lib/auth.py	Wed Apr 07 00:51:55 2010 +0200
+++ b/pylons_app/lib/auth.py	Wed Apr 07 13:24:46 2010 +0200
@@ -17,8 +17,12 @@
     conn, cur = get_sqlite_cur_conn()
     password_crypt = crypt.crypt(password, '6a')
 
-    cur.execute("SELECT * FROM users WHERE username=?", (username,))
-    data = cur.fetchone()
+    try:
+        cur.execute("SELECT * FROM users WHERE username=?", (username,))
+        data = cur.fetchone()
+    except sqlite3.OperationalError as e:
+        data = None
+        log.error(e)
 
     if data:
         if data[3]: