From 092f1cda0ce9d17191959d0f027340df23c1f6d1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 6 Dec 2021 21:29:33 -0600 Subject: [PATCH] Honor "safe for web app" flags for import/export handlers --- tailbone/templates/importing/runjob.mako | 5 +++++ tailbone/views/importing.py | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tailbone/templates/importing/runjob.mako b/tailbone/templates/importing/runjob.mako index 2b9642f6..2bc2a4e9 100644 --- a/tailbone/templates/importing/runjob.mako +++ b/tailbone/templates/importing/runjob.mako @@ -44,7 +44,12 @@ {{ submittingRun ? "Working, please wait..." : "Run this ${handler.direction.capitalize()}" }} diff --git a/tailbone/views/importing.py b/tailbone/views/importing.py index 80f54c37..4d142cf3 100644 --- a/tailbone/views/importing.py +++ b/tailbone/views/importing.py @@ -129,6 +129,7 @@ class ImportingView(MasterView): 'handler_spec': handler.get_spec(), 'direction': handler.direction, 'direction_display': handler.direction.capitalize(), + 'safe_for_web_app': handler.safe_for_web_app, } if keep_handler: @@ -314,7 +315,13 @@ class ImportingView(MasterView): if self.request.POST.get('runjob') == 'true': - # will invoke handler to run job + # will invoke handler to run job.. + + # ..but only if it is safe to do so + if not handler.safe_for_web_app: + self.request.session.flash("Handler is not (yet) safe to run " + "with this tool", 'error') + return self.redirect(self.request.current_route_url()) # TODO: this socket progress business was lifted from # tailbone.views.batch.core:BatchMasterView.handler_action