From bb637156345ea21b3be6ddde888eaa813e763935 Mon Sep 17 00:00:00 2001 From: alex-eri Date: Wed, 13 Jun 2018 23:19:25 +0300 Subject: [PATCH] example not working (#168) --- demo/database_auth/db_auth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/database_auth/db_auth.py b/demo/database_auth/db_auth.py index be206f9..3c3eb93 100644 --- a/demo/database_auth/db_auth.py +++ b/demo/database_auth/db_auth.py @@ -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)