diff options
author | zsloan | 2022-04-04 19:24:48 +0000 |
---|---|---|
committer | zsloan | 2022-04-04 19:24:48 +0000 |
commit | 170717295c37fcaef5be84410b831f44e128f994 (patch) | |
tree | 03644ac0f7214a65c24b775c8a2120525c7dbd53 | |
parent | 8f12a4d258eb38a653022a395beb34b62ae5c1b4 (diff) | |
download | genenetwork2-170717295c37fcaef5be84410b831f44e128f994.tar.gz |
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
-rw-r--r-- | wqflask/utility/redis_tools.py | 5 |
1 files changed, 4 insertions, 1 deletions
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): |