summaryrefslogtreecommitdiff
path: root/archaeological_operations/data_importer.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-10-22 15:40:03 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-10-22 15:40:03 +0200
commit01b50d1b29e1b1e99f811614776d44a9aa3ce9bd (patch)
tree6edbc7f7b083333bff302c7d08e3a6fef7637c0f /archaeological_operations/data_importer.py
parentc383d0c5a517f9860c633c891f20523afeff9f2f (diff)
downloadIshtar-01b50d1b29e1b1e99f811614776d44a9aa3ce9bd.tar.bz2
Ishtar-01b50d1b29e1b1e99f811614776d44a9aa3ce9bd.zip
archaeological_files SRA import: better management of numerical id
Diffstat (limited to 'archaeological_operations/data_importer.py')
-rw-r--r--archaeological_operations/data_importer.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/archaeological_operations/data_importer.py b/archaeological_operations/data_importer.py
index 5083910c2..6c89ebaa5 100644
--- a/archaeological_operations/data_importer.py
+++ b/archaeological_operations/data_importer.py
@@ -49,8 +49,15 @@ class ImportParcelFormater(ImportFormater):
try:
models.Parcel.objects.get_or_create(**parcel_dct)
except IntegrityError:
- raise ImporterError("Erreur d'import parcelle, contexte : %s"
- % unicode(parcel_dct))
+ try:
+ p = unicode(parcel_dct)
+ except UnicodeDecodeError:
+ try:
+ p = str(parcel_dct).decode('utf-8')
+ except UnicodeDecodeError:
+ p = u""
+ raise ImporterError(u"Erreur d'import parcelle, contexte : %s"
+ % p)
class ImportYearFormater(ImportFormater):