From 979c0cbe48e23d9c859d5676c74cc6026ab6db52 Mon Sep 17 00:00:00 2001 From: Jannis Date: Wed, 2 Mar 2016 14:34:36 +0100 Subject: [PATCH] Pass message instead of object representation Exceptions implement `.__str__` which can be used to be passed to the template error output. This prevents ugly string formatting like `u''`. --- import_export/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import_export/resources.py b/import_export/resources.py index bf910e946..6ad0731f5 100644 --- a/import_export/resources.py +++ b/import_export/resources.py @@ -341,7 +341,7 @@ def import_data(self, dataset, dry_run=False, raise_errors=False, except Exception as e: logging.exception(e) tb_info = traceback.format_exc() - result.base_errors.append(Error(repr(e), tb_info)) + result.base_errors.append(Error(e, tb_info)) if raise_errors: if use_transactions: savepoint_rollback(sp1)