example not working (#168)

This commit is contained in:
alex-eri 2018-06-13 23:19:25 +03:00 committed by Nikolay Novik
parent 79e811ea79
commit bb63715634
1 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ class DBAuthorizationPolicy(AbstractAuthorizationPolicy):
self.dbengine = dbengine
async def authorized_userid(self, identity):
async with self.dbengine as conn:
async with self.dbengine.acquire() as conn:
where = sa.and_(db.users.c.login == identity,
sa.not_(db.users.c.disabled))
query = db.users.count().where(where)
@ -25,7 +25,7 @@ class DBAuthorizationPolicy(AbstractAuthorizationPolicy):
if identity is None:
return False
async with self.dbengine as conn:
async with self.dbengine.acquire() as conn:
where = sa.and_(db.users.c.login == identity,
sa.not_(db.users.c.disabled))
query = db.users.select().where(where)
@ -50,7 +50,7 @@ class DBAuthorizationPolicy(AbstractAuthorizationPolicy):
async def check_credentials(db_engine, username, password):
async with db_engine as conn:
async with db_engine.acquire() as conn:
where = sa.and_(db.users.c.login == username,
sa.not_(db.users.c.disabled))
query = db.users.select().where(where)