Skip to content

Commit

Permalink
Merge pull request django-import-export#417 from jnns/master
Browse files Browse the repository at this point in the history
Make line errors more readable
  • Loading branch information
bmihelac committed Mar 2, 2016
2 parents 034330a + 979c0cb commit 0f86101
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion import_export/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,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)
Expand Down
9 changes: 2 additions & 7 deletions import_export/templates/admin/import_export/import.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ <h1>{% trans "Import" %}</h1>

<p>
{% trans "This importer will import the following fields: " %}
{% for f in fields %}
{% if forloop.counter0 %}
,
{% endif %}
<code>{{ f }}</code>
{% endfor %}
<code>{{ fields|join:", " }}</code>
</p>

<fieldset class="module aligned">
Expand Down Expand Up @@ -73,7 +68,7 @@ <h2>{% trans "Errors" %}</h2>
{% for error in errors %}
<li>
{% trans "Line number" %}: {{ line }} - {{ error.error }}
<div>{{ error.row }}</div>
<div><code>{{ error.row.values|join:", " }}</code></div>
<div class="traceback">{{ error.traceback|linebreaks }}</div>
</li>
{% endfor %}
Expand Down

0 comments on commit 0f86101

Please sign in to comment.