From 170717295c37fcaef5be84410b831f44e128f994 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 4 Apr 2022 19:24:48 +0000 Subject: Return None in load_json_from_redis when the item doesn't exist For some reason that isn't clear to me yet, a logged-in user session ID was set even when a user wasn't logged in, causing the user session code to attempt to fetch user information for a non-existent user ID --- wqflask/utility/redis_tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'wqflask/utility') diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py index a6c5875f..641d973e 100644 --- a/wqflask/utility/redis_tools.py +++ b/wqflask/utility/redis_tools.py @@ -28,7 +28,10 @@ def is_redis_available(): def load_json_from_redis(item_list, column_value): if type(column_value) == str: column_value = str.encode(column_value) - return json.loads(item_list[column_value]) + try: + return json.loads(item_list[column_value]) + except: + return None def get_user_id(column_name, column_value): -- cgit v1.2.3