From 56695d0c205d82830cfc4e46d8946e84f7ef9ea8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 11 May 2017 09:49:15 -0500 Subject: [PATCH] Allow batch view to override execution failure message --- tailbone/views/batch/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index 9607b106..a5556c25 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -752,6 +752,9 @@ class BatchMasterView(MasterView): self.request.session.flash("Sorry, you must POST to execute a batch.", 'error') return self.redirect(self.get_action_url('view', batch)) + def execute_error_message(self, error): + return "Batch execution failed: {}: {}".format(type(error).__name__, error) + def execute_thread(self, batch_uuid, user_uuid, progress=None, **kwargs): """ Thread target for executing a batch with progress indicator. @@ -773,7 +776,7 @@ class BatchMasterView(MasterView): if progress: progress.session.load() progress.session['error'] = True - progress.session['error_msg'] = "Batch execution failed: {}: {}".format(type(error).__name__, error) + progress.session['error_msg'] = self.execute_error_message(error) progress.session.save() # If no error, check result flag (false means user canceled).