load user

This commit is contained in:
zuk 2017-02-11 15:33:48 +01:00
parent 0dfd3ea31a
commit 1ea4ec5df6

View file

@ -1,10 +1,17 @@
import psycopg2
import psycopg2.extras
class DbManager(object):
def __init__(self,db_uri):
self.db_uri=db_uri
self.conn=psycopg2.connect(db_uri)
self.conn=psycopg2.connect(db_uri,cursor_factory=psycopg2.extras.DictCursor)
def load_user(self,username):
with self.conn.cursor() as c:
c.execute("select * from users where username=%s",(username,))
user=c.fetchOne()
return user