From 3e53295516f730ea7face7087dd0b0b909284286 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Fri, 25 Nov 2022 20:22:55 -0600 Subject: [PATCH] don't want to crash on our precious logging code --- files/routes/wrappers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index ea2ec57b6..a4cf350df 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -23,11 +23,11 @@ def calc_users(v): print("calc_users called with missing context data") if request: print(f"while serving {request.method} {request.full_path}") - print(f"user agent: {g.agent}") + print(f"user agent: {getattr(g, 'agent', '-attribute not present-')}") else: print("no request context") print(f"v: {v}") - print(f"db?: {bool(g.db)}") + print(f"db?: {bool(getattr(g, 'db', None))}") # end temp logging code loggedin = cache.get(f'{SITE}_loggedin') or {} loggedout = cache.get(f'{SITE}_loggedout') or {}