aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2020-09-28 18:00:00 +0300
committerBonfaceKilz2020-09-28 18:00:00 +0300
commita8c983a69b12ff32a30d488d7f326915f1aa7d63 (patch)
tree154a3d0482514cbbb2f545f7b921e3ca2c21203f /wqflask
parent3ec4eb6b831eaa5adcf32a9fca8a60ea229cc1c4 (diff)
downloadgenenetwork2-a8c983a69b12ff32a30d488d7f326915f1aa7d63.tar.gz
Fix casting error
* wqflask/base/trait.py (retrieve_trait_info): If the description_string or discription_display value return a None object, evaluate to an empty string. Fixes errors related to *len(None)*.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/trait.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 7666348e..03c4b079 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -507,13 +507,14 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
description_string = unicode(str(trait.description).strip(codecs.BOM_UTF8), 'utf-8')
target_string = unicode(str(trait.probe_target_description).strip(codecs.BOM_UTF8), 'utf-8')
- if len(description_string) > 1 and description_string != 'None':
+ if str(description_string or "") != "" and description_string != 'None':
description_display = description_string
else:
description_display = trait.symbol
- if (len(description_display) > 1 and description_display != 'N/A' and
- len(target_string) > 1 and target_string != 'None'):
+ if (str(description_display or "") != "" and
+ description_display != 'N/A' and
+ str(target_string or "") != "" and target_string != 'None'):
description_display = description_display + '; ' + target_string.strip()
# Save it for the jinja2 template
@@ -607,4 +608,4 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
else:
raise KeyError, `trait.name`+' information is not found in the database.'
- return trait \ No newline at end of file
+ return trait