aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/trait.py
diff options
context:
space:
mode:
authorzsloan2020-07-06 14:47:04 -0500
committerzsloan2020-07-06 14:47:04 -0500
commit0a0d733af4b6c61c381a1c4ec9fa162182a057e9 (patch)
tree2fb77bcbce7650af08b647fc3089e89d596169ba /wqflask/base/trait.py
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/base/trait.py')
-rw-r--r--wqflask/base/trait.py30
1 files changed, 8 insertions, 22 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 7fc016f3..4c3e790c 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -49,7 +49,6 @@ def create_trait(**kw):
if "view" in permissions['data']:
the_trait = GeneralTrait(**kw)
if the_trait.dataset.type != "Temp":
-
the_trait = retrieve_trait_info(the_trait, the_trait.dataset, get_qtl_info=kw.get('get_qtl_info'))
return the_trait
else:
@@ -144,6 +143,7 @@ class GeneralTrait(object):
formatted = self.post_publication_description
else:
formatted = "Not available"
+
return formatted
@property
@@ -388,27 +388,14 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
try:
response = requests.get(the_url).content
- if response.strip() == "no-access":
- trait.view = False
- return trait
- else:
- trait_info = json.loads(response)
- except:
- resource_info = get_resource_info(resource_id)
- if resource_info:
- default_permissions = resource_info['default_mask']['data']
- else:
- default_permissions = webqtlConfig.DEFAULT_PRIVILEGES
- if 'view' not in default_permissions:
- trait.view = False
- return trait
-
+ trait_info = json.loads(response)
+ except: #ZS: I'm assuming the trait is viewable if the try fails for some reason; it should never reach this point unless the user has privileges, since that's dealt with in create_trait
if dataset.type == 'Publish':
query = """
SELECT
- PublishXRef.Id, Publication.PubMed_ID,
+ PublishXRef.Id, InbredSet.InbredSetCode, Publication.PubMed_ID,
Phenotype.Pre_publication_description, Phenotype.Post_publication_description, Phenotype.Original_description,
- Phenotype.Pre_publication_abbreviation, Phenotype.Post_publication_abbreviation,
+ Phenotype.Pre_publication_abbreviation, Phenotype.Post_publication_abbreviation, PublishXRef.mean,
Phenotype.Lab_code, Phenotype.Submitter, Phenotype.Owner, Phenotype.Authorized_Users,
Publication.Authors, Publication.Title, Publication.Abstract,
Publication.Journal, Publication.Volume, Publication.Pages,
@@ -472,11 +459,10 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
if trait_info:
trait.haveinfo = True
-
for i, field in enumerate(dataset.display_fields):
- holder = trait_info[i]
- #if isinstance(trait_info[i], basestring):
- # holder = holder.encode('latin1')
+ holder = trait_info[i]
+ # if isinstance(trait_info[i], basestring):
+ # holder = unicode(holder.strip(codecs.BOM_UTF8), 'utf-8', "ignore")
setattr(trait, field, holder)
if dataset.type == 'Publish':