From c228aff0cc9480f7b9ee46e54c9fef0f46299a3d Mon Sep 17 00:00:00 2001 From: zsloan Date: Sun, 17 Jan 2021 14:57:52 -0600 Subject: Set default description to avoid error in situations where description is None --- wqflask/wqflask/search_results.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index c4ea2921..9e8001cf 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -120,7 +120,9 @@ class SearchResultPage(object): trait_dict['hmac'] = hmac.data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) if this_trait.dataset.type == "ProbeSet": trait_dict['symbol'] = this_trait.symbol - trait_dict['description'] = this_trait.description_display + trait_dict['description'] = "N/A" + if this_trait.description_display: + trait_dict['description'] = this_trait.description_display trait_dict['location'] = this_trait.location_repr trait_dict['mean'] = "N/A" trait_dict['additive'] = "N/A" @@ -136,7 +138,9 @@ class SearchResultPage(object): elif this_trait.dataset.type == "Geno": trait_dict['location'] = this_trait.location_repr elif this_trait.dataset.type == "Publish": - trait_dict['description'] = this_trait.description_display + trait_dict['description'] = "N/A" + if this_trait.description_display: + trait_dict['description'] = this_trait.description_display trait_dict['authors'] = this_trait.authors trait_dict['pubmed_id'] = "N/A" if this_trait.pubmed_id: -- cgit v1.2.3