summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-06-18 03:04:37 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-06-18 03:04:37 +0200
commit5d9f96733cb9184f2c3d20165dcd2330183f71e0 (patch)
tree842f5c0b692274ba37949b95a074754f2b119325 /ishtar_common/models.py
parentecf8b2435ca903dc9b70c514dafdc28f69640bb0 (diff)
parente6ebb33d4175f42b55a0532940ddada73f48e18b (diff)
downloadIshtar-5d9f96733cb9184f2c3d20165dcd2330183f71e0.tar.bz2
Ishtar-5d9f96733cb9184f2c3d20165dcd2330183f71e0.zip
Merge branch 'stable'
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 4ec4bf370..5dfac246e 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1439,13 +1439,15 @@ class Import(models.Model):
@property
def data_table(self):
with open(self.imported_file.path) as csv_file:
- try:
- return [line for line in unicodecsv.reader(csv_file,
- encoding=self.encoding)]
- except UnicodeDecodeError:
- if encoding != encodings[-1]:
- csv_file.seek(0)
- return []
+ encodings = [self.encoding]
+ encodings += [coding for coding, c in ENCODINGS]
+ for encoding in encodings:
+ try:
+ return [line for line in unicodecsv.reader(csv_file,
+ encoding=encoding)]
+ except UnicodeDecodeError:
+ if encoding != encodings[-1]:
+ csv_file.seek(0)
return []
def initialize(self):