aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/trait.py
diff options
context:
space:
mode:
authorzsloan2020-06-20 17:33:22 -0500
committerzsloan2020-06-20 17:33:22 -0500
commit75802ed1f9e5d955987bf5f5eb78a9cb120116ec (patch)
tree0f4d15467ce57ef2b2978a07f53f379dd22bf535 /wqflask/base/trait.py
parentfcb3cb1105cf2a1d97c1a08fa636b118ed231ffa (diff)
downloadgenenetwork2-75802ed1f9e5d955987bf5f5eb78a9cb120116ec.tar.gz
Added some admin functionality and fixed issue with temp traits
Diffstat (limited to 'wqflask/base/trait.py')
-rw-r--r--wqflask/base/trait.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 7700ecd5..c2b8b910 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -42,11 +42,11 @@ def create_trait(**kw):
if kw.get('dataset_name') != "Temp":
if dataset.type == 'Publish':
- permitted = check_resource_availability(dataset, kw.get('name'))
+ permissions = check_resource_availability(dataset, kw.get('name'))
else:
- permitted = check_resource_availability(dataset)
+ permissions = check_resource_availability(dataset)
- if permitted != "no-access":
+ if "view" in permissions['data']:
the_trait = GeneralTrait(**kw)
if the_trait.dataset.type != "Temp":
@@ -382,9 +382,16 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
resource_id = get_resource_id(dataset, trait.name)
if dataset.type == 'Publish':
- the_url = "http://localhost:8080/run-action?resource={}&user={}&branch=data&action=view".format(resource_id, g.user_session.user_id)
+ the_url = "http://localhost:8081/run-action?resource={}&user={}&branch=data&action=view".format(resource_id, g.user_session.user_id)
else:
- the_url = "http://localhost:8080/run-action?resource={}&user={}&branch=data&action=view&trait={}".format(resource_id, g.user_session.user_id, trait.name)
+ the_url = "http://localhost:8081/run-action?resource={}&user={}&branch=data&action=view&trait={}".format(resource_id, g.user_session.user_id, trait.name)
+
+ response = requests.get(the_url).content
+ if response.strip() == "no-access":
+ trait.view = False
+ return trait
+ else:
+ trait_info = json.loads(response)
try:
response = requests.get(the_url).content