From 8b8397fb5ddf66492d5fb6c085860374d2c3625d Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Thu, 1 Dec 2022 15:49:27 +0300 Subject: Use a dataset's name to fetch it's metadata * wqflask/wqflask/views.py (show_trait_page): Use a dataset's name - from the query parameters - to fetch metadata. --- wqflask/wqflask/views.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 028512dd..2477b2c0 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -490,23 +490,21 @@ def show_trait_page(): template_vars.js_data = json.dumps(template_vars.js_data, default=json_default_handler, indent=" ") - + # Should there be any mis-configurations, things will still + # work. + metadata = {} try: - metadata = ( - template_vars.dataset.accession_id - .bind( - lambda idx: requests.get( - urljoin( - GN3_LOCAL_URL, - f"/api/metadata/dataset/GN{idx}") - ) - ) + metadata = requests.get( + urljoin( + GN3_LOCAL_URL, + f"/api/metadata/dataset/{request.args.get('dataset')}") ).json() except: metadata = {} - - return render_template("show_trait.html", - metadata=metadata, **template_vars.__dict__) + return render_template( + "show_trait.html", + metadata=metadata, + **template_vars.__dict__) @app.route("/heatmap", methods=('POST',)) -- cgit v1.2.3