diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index 966726c0..dfdb0ed5 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -44,7 +44,7 @@ from sqlalchemy import orm from rattail.db import model, Session as RattailSession from rattail.db.util import short_session from rattail.threads import Thread -from rattail.util import load_object, prettify +from rattail.util import load_object, prettify, simple_error from rattail.progress import SocketProgress import colander @@ -1057,7 +1057,8 @@ class BatchMasterView(MasterView): if progress: progress.session.load() progress.session['error'] = True - progress.session['error_msg'] = "Batch population failed: {} - {}".format(error.__class__.__name__, error) + progress.session['error_msg'] = "Batch population failed: {}".format( + simple_error(error)) progress.session.save() return @@ -1113,7 +1114,8 @@ class BatchMasterView(MasterView): if progress: progress.session.load() progress.session['error'] = True - progress.session['error_msg'] = "Data refresh failed: {} {}".format(error.__class__.__name__, error) + progress.session['error_msg'] = "Data refresh failed: {}".format( + simple_error(error)) progress.session.save() return @@ -1262,7 +1264,7 @@ class BatchMasterView(MasterView): }, mobile=True) def execute_error_message(self, error): - return "Batch execution failed: {}: {}".format(type(error).__name__, error) + return "Batch execution failed: {}".format(simple_error(error)) def execute_thread(self, batch_uuid, user_uuid, progress, **kwargs): """ diff --git a/tailbone/views/master.py b/tailbone/views/master.py index 01f438f0..d724b0ee 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -41,14 +41,13 @@ from sqlalchemy_utils.functions import get_primary_keys from rattail.db import model, Session as RattailSession from rattail.db.continuum import model_transaction_query from rattail.core import Object -from rattail.util import prettify +from rattail.util import prettify, OrderedDict, simple_error from rattail.time import localtime from rattail.threads import Thread from rattail.csvutil import UnicodeDictWriter from rattail.files import temp_path from rattail.excel import ExcelWriter from rattail.gpc import GPC -from rattail.util import OrderedDict import colander import deform @@ -978,7 +977,8 @@ class MasterView(View): if progress: progress.session.load() progress.session['error'] = True - progress.session['error_msg'] = "{}: {} {}".format(msg, error.__class__.__name__, error) + progress.session['error_msg'] = "{}: {}".format( + msg, simple_error(error)) progress.session.save() return @@ -1835,7 +1835,8 @@ class MasterView(View): if progress: progress.session.load() progress.session['error'] = True - progress.session['error_msg'] = "Bulk deletion failed: {}: {}".format(type(error).__name__, error) + progress.session['error_msg'] = "Bulk deletion failed: {}".format( + simple_error(error)) progress.session.save() # If no error, check result flag (false means user canceled). @@ -1992,8 +1993,8 @@ class MasterView(View): progress.session.save() def execute_error_message(self, error): - return "Execution of {} failed: {}: {}".format(self.get_model_title(), - type(error).__name__, error) + return "Execution of {} failed: {}".format(self.get_model_title(), + simple_error(error)) def get_execute_success_url(self, obj, **kwargs): return self.get_action_url('view', obj, **kwargs) diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index fc81acd7..eb5e5f4d 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -38,7 +38,7 @@ from rattail.db import model, api, Session as RattailSession from rattail.db.util import maxlen from rattail.gpc import GPC from rattail.time import localtime, make_utc -from rattail.util import pretty_quantity, prettify, OrderedDict +from rattail.util import pretty_quantity, prettify, OrderedDict, simple_error from rattail.vendors.invoices import iter_invoice_parsers, require_invoice_parser from rattail.threads import Thread @@ -1839,8 +1839,8 @@ class ReceivingBatchView(PurchasingBatchView): if progress: progress.session.load() progress.session['error'] = True - progress.session['error_msg'] = "Auto-receive failed: {}: {}".format( - type(error).__name__, error) + progress.session['error_msg'] = "Auto-receive failed: {}".format( + simple_error(error)) progress.session.save() # if no error, check result flag (false means user canceled) diff --git a/tailbone/views/reports.py b/tailbone/views/reports.py index 33f7e39a..f8685dcf 100644 --- a/tailbone/views/reports.py +++ b/tailbone/views/reports.py @@ -38,6 +38,7 @@ from rattail.files import resource_path from rattail.time import localtime from rattail.reporting import get_report_handler from rattail.threads import Thread +from rattail.util import simple_error import colander from mako.template import Template @@ -410,8 +411,8 @@ class GenerateReport(View): if progress: progress.session.load() progress.session['error'] = True - progress.session['error_msg'] = "Failed to generate report: {}: {}".format( - type(error).__name__, error) + progress.session['error_msg'] = "Failed to generate report: {}".format( + simple_error(error)) progress.session.save() # if no error, check result flag (false means user canceled)