From 1a2866ddf844cc1009682a3d2cff056ec3b037bb Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 31 Aug 2023 08:01:16 +0300 Subject: Use error-display utility Use the error-display utility to get rid of an unnecessary error-handling function. --- wqflask/wqflask/views.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 98c7f479..f24e033a 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -79,7 +79,7 @@ from wqflask.db_info import InfoPage from wqflask.oauth2 import client from wqflask.oauth2.client import no_token_get -from wqflask.oauth2.request_utils import process_error +from wqflask.oauth2.request_utils import with_flash_error from utility import temp_data from utility.tools import get_setting @@ -520,16 +520,13 @@ def show_trait_page(): }) dataset = request.args["dataset"] trait_id = request.args["trait_id"] - def __failure__(err): - error = process_error(err) - flash(f"{error['error']}: {error['error_description']}", "alert-error") - return render_template("show_trait_error.html") return client.post( "oauth2/data/authorisation", json={ "traits": [f"{dataset}::{trait_id}"] - }).either(__failure__, __show_trait__) + }).either(with_flash_error(render_template("show_trait_error.html")), + __show_trait__) @app.route("/heatmap", methods=('POST',)) -- cgit v1.2.3