aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorAlexanderlacuna2020-11-03 20:44:01 +0300
committerAlexanderlacuna2020-11-03 20:44:01 +0300
commite1f6955f8a3c8d2c9d397d0b4a21fd781a360ce4 (patch)
tree5ad32d574126212a7bd8cb39dc2acafee3fcc061 /wqflask/utility
parent8630b727d80f52b3e846c9eb3bf7dd4e844fa626 (diff)
parent055311c6a425214883fe7f2aa0b333b2a9d68e34 (diff)
downloadgenenetwork2-e1f6955f8a3c8d2c9d397d0b4a21fd781a360ce4.tar.gz
Merge branch 'testing' of https://github.com/genenetwork/genenetwork2 into test-showtrait
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/redis_tools.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py
index d855a7fa..236cc755 100644
--- a/wqflask/utility/redis_tools.py
+++ b/wqflask/utility/redis_tools.py
@@ -25,6 +25,10 @@ def is_redis_available():
return True
+def load_json_from_redis(item_list, column_value):
+ return json.loads(item_list[str.encode(column_value)])
+
+
def get_user_id(column_name, column_value):
user_list = Redis.hgetall("users")
key_list = []
@@ -46,7 +50,7 @@ def get_user_by_unique_column(column_name, column_value):
if column_name in user_ob and user_ob[column_name] == column_value:
item_details = user_ob
else:
- item_details = json.loads(user_list[column_value])
+ item_details = load_json_from_redis(user_list, column_value)
return item_details
@@ -70,7 +74,7 @@ def get_users_like_unique_column(column_name, column_value):
if column_value in user_ob[column_name]:
matched_users.append(user_ob)
else:
- matched_users.append(json.loads(user_list[column_value]))
+ matched_users.append(load_json_from_redis(user_list, column_value))
return matched_users
@@ -199,7 +203,7 @@ def get_groups_like_unique_column(column_name, column_value):
if column_value in group_info[column_name]:
matched_groups.append(group_info)
else:
- matched_groups.append(json.loads(group_list[column_value]))
+ matched_groups.append(load_json_from_redis(group_list, column_value))
return matched_groups