diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-14 20:47:35 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-14 20:47:35 +0100 |
commit | d147e85723e8c9d3466c9b3d56288696b21a6ad8 (patch) | |
tree | 6676db2c7e898db0677f0440c5a979616827b8a8 /ishtar_common/models.py | |
parent | a372122f76ed2775a858399f790e10807f637d60 (diff) | |
download | Ishtar-d147e85723e8c9d3466c9b3d56288696b21a6ad8.tar.bz2 Ishtar-d147e85723e8c9d3466c9b3d56288696b21a6ad8.zip |
Importer: report bad configuration in a cleaner way
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 90e2bd6f6..c1edc13c6 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -22,6 +22,7 @@ Models description """ from cStringIO import StringIO import copy +import csv import datetime from PIL import Image from importlib import import_module @@ -2302,6 +2303,19 @@ class Import(models.Model): return bool(TargetKey.objects.filter(associated_import=self, is_set=False).count()) + @property + def errors(self): + if not self.error_file: + return [] + errors = [] + with open(self.error_file.path, 'rb') as csvfile: + reader = csv.DictReader(csvfile, fieldnames=['line', 'column', + 'error']) + reader.next() # pass the header + for row in reader: + errors.append(row) + return errors + def get_actions(self): """ Get available action relevant with the current status |