aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/show_trait/export_trait_data.py3
-rw-r--r--wqflask/wqflask/show_trait/show_trait.py1
-rw-r--r--wqflask/wqflask/views.py4
3 files changed, 5 insertions, 3 deletions
diff --git a/wqflask/wqflask/show_trait/export_trait_data.py b/wqflask/wqflask/show_trait/export_trait_data.py
index a99e72a6..7ca4a4c0 100644
--- a/wqflask/wqflask/show_trait/export_trait_data.py
+++ b/wqflask/wqflask/show_trait/export_trait_data.py
@@ -7,6 +7,7 @@ from pprint import pformat as pf
def export_sample_table(targs):
sample_data = json.loads(targs['export_data'])
+ trait_name = targs['trait_display_name']
final_sample_data = []
for sample_group in ['primary_samples', 'other_samples']:
@@ -15,7 +16,7 @@ def export_sample_table(targs):
print("sorted_row is:", pf(sorted_row))
final_sample_data.append(sorted_row)
- return final_sample_data
+ return trait_name, final_sample_data
def dict_to_sorted_list(dictionary):
sorted_list = [item for item in dictionary.iteritems()]
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 5d2f52cb..c81d68d0 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -210,6 +210,7 @@ class ShowTrait(object):
hddn['allsamples'] = string.join(self.dataset.group.allsamples, ' ')
hddn['primary_samples'] = string.join(self.primary_sample_names, ',')
hddn['trait_id'] = self.trait_id
+ hddn['trait_display_name'] = self.this_trait.display_name
hddn['dataset'] = self.dataset.name
hddn['temp_trait'] = False
if self.temp_trait:
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 1c513591..dfecb63f 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -321,7 +321,7 @@ def export_trait_excel():
logger.info("In export_trait_excel")
logger.info("request.form:", request.form)
logger.info(request.url)
- sample_data = export_trait_data.export_sample_table(request.form)
+ trait_name, sample_data = export_trait_data.export_sample_table(request.form)
logger.info("sample_data - type: %s -- size: %s" % (type(sample_data), len(sample_data)))
@@ -337,7 +337,7 @@ def export_trait_excel():
return Response(excel_data,
mimetype='application/vnd.ms-excel',
- headers={"Content-Disposition":"attachment;filename=sample_data.xlsx"})
+ headers={"Content-Disposition":"attachment;filename="+ trait_name + ".xlsx"})
@app.route('/export_trait_csv', methods=('POST',))
def export_trait_csv():