aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorzsloan2020-07-06 14:47:04 -0500
committerzsloan2020-07-06 14:47:04 -0500
commit0a0d733af4b6c61c381a1c4ec9fa162182a057e9 (patch)
tree2fb77bcbce7650af08b647fc3089e89d596169ba /wqflask/utility
parentaa06c83ecd4d36878ac0aadd75ab2bd461f44344 (diff)
downloadgenenetwork2-0a0d733af4b6c61c381a1c4ec9fa162182a057e9.tar.gz
Fixed some of the logic with how traits are authenticated to avoid situation where a trait is authenticated twice
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/redis_tools.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py
index 8a5f95ee..6c912a23 100644
--- a/wqflask/utility/redis_tools.py
+++ b/wqflask/utility/redis_tools.py
@@ -285,13 +285,14 @@ def get_resource_info(resource_id):
else:
return None
-def add_resource(resource_info):
+def add_resource(resource_info, update=True):
if 'trait' in resource_info['data']:
resource_id = hmac.hmac_creation('{}:{}:{}'.format(str(resource_info['type']), str(resource_info['data']['dataset']), str(resource_info['data']['trait'])))
else:
resource_id = hmac.hmac_creation('{}:{}'.format(str(resource_info['type']), str(resource_info['data']['dataset'])))
- Redis.hset("resources", resource_id, json.dumps(resource_info))
+ if not Redis.hexists("resources", resource_id):
+ Redis.hset("resources", resource_id, json.dumps(resource_info))
return resource_info