From 5e860ecd430c4adfd11aa1932927e93a2b6bafce Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 29 Nov 2022 18:04:43 +0100 Subject: Imports: fix error interception for GeoVectorData --- CHANGES.md | 1 + ishtar_common/data_importer.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 77db18ed7..2412157e1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ WIP ### Improvements ### - Context record: add Unit to indexed search +- Admin: small improvements on syndication ### Bug fixes ### - Fix redirect URL after logout diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 63a8d65cf..5b3509b3e 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1453,12 +1453,16 @@ class Importer(object): ) if q.count(): item = q.all()[0] - if item: - for k in geodata: - setattr(item, k, geodata[k]) - item.save() - else: - item = GeoVectorData.objects.create(**geodata) + try: + if item: + for k in geodata: + setattr(item, k, geodata[k]) + item.save() + else: + item = GeoVectorData.objects.create(**geodata) + except Exception as e: + self.errors.append((self.idx_line, None, str(e))) + return if self.import_instance: item.imports.add(self.import_instance) if self.MAIN_GEO: -- cgit v1.2.3