aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/trait.py
diff options
context:
space:
mode:
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