From 4a0f2177fe9c82bd3c6636708e9d5112ad7207a1 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 24 Dec 2021 05:05:29 +0200 Subject: [PATCH] dfs --- files/helpers/wrappers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 9185ed270..92bcb410d 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -7,7 +7,7 @@ def get_logged_in_user(): token = request.headers.get("Authorization","").strip() if token: - if g.db: client = g.db.query(ClientAuth).filter(ClientAuth.access_token == token).one_or_none() + if hasattr(g, 'db') and g.db: client = g.db.query(ClientAuth).filter(ClientAuth.access_token == token).one_or_none() else: return None if not client: return None @@ -21,7 +21,7 @@ def get_logged_in_user(): nonce = session.get("login_nonce", 0) try: - if g.db: v = g.db.query(User).filter_by(id=lo_user).one_or_none() + if hasattr(g, 'db') and g.db: v = g.db.query(User).filter_by(id=lo_user).one_or_none() else: return None except: return None