diff options
author | zsloan | 2019-12-04 14:55:38 -0600 |
---|---|---|
committer | zsloan | 2019-12-04 14:55:38 -0600 |
commit | 3826862d8e7b0f337198b24405fc4654bd82b774 (patch) | |
tree | 87787a324afa9c10dcd998bc35e5b20b06547489 | |
parent | 3ba395fcfc5c5038673681ef913afbf0ffbc3a1f (diff) | |
download | genenetwork2-3826862d8e7b0f337198b24405fc4654bd82b774.tar.gz |
Changed export code to accept some missing paramters
-rw-r--r-- | wqflask/wqflask/export_traits.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py index 724350ac..bc029965 100644 --- a/wqflask/wqflask/export_traits.py +++ b/wqflask/wqflask/export_traits.py @@ -20,16 +20,20 @@ def export_search_results_csv(targs): metadata = [] - if targs['database_name'] != "None": - metadata.append(["Data Set: " + targs['database_name']]) - if targs['accession_id'] != "None": - metadata.append(["Metadata Link: http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=" + targs['accession_id']]) + if 'database_name' in targs: + if targs['database_name'] != "None": + metadata.append(["Data Set: " + targs['database_name']]) + if 'accession_id' in targs: + if targs['accession_id'] != "None": + metadata.append(["Metadata Link: http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=" + targs['accession_id']]) metadata.append(["Export Date: " + datetime.datetime.now().strftime("%B %d, %Y")]) metadata.append(["Export Time: " + datetime.datetime.now().strftime("%H:%M GMT")]) - if targs['accession_id'] != "None": - metadata.append(["Data Ownership and References: Please see http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=" + targs['accession_id']]) - metadata.append(["Search Query: " + targs['search_string']]) - metadata.append(["Search Filter Terms: " + targs['filter_term']]) + if 'search_string' in targs: + if targs['search_string'] != "None": + metadata.append(["Search Query: " + targs['search_string']]) + if 'filter_term' in targs: + if targs['filter_term'] != "None": + metadata.append(["Search Filter Terms: " + targs['filter_term']]) metadata.append(["Exported Row Number: " + str(len(table_rows))]) for metadata_row in metadata: |