From 13d4acddf63858e59c798837cf4c1f2d29945dd7 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 22 Mar 2024 13:10:52 +0100 Subject: ✨ Debug mode for imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/data_importer.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ishtar_common/data_importer.py') diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 90cabf0b1..b4be3d297 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -741,6 +741,7 @@ class Importer(object): MAIN_GEO = False LINE_FORMAT = [] OBJECT_CLS = None + DEBUG = False UNICITY_KEYS = [] # if set only models inside this list can be created MODEL_CREATION_LIMIT = [] @@ -835,6 +836,7 @@ class Importer(object): self._pre_import_values = self.PRE_IMPORT_VALUES.copy() self.history_modifier = history_modifier self.output = output + self.debug = [] if not self.history_modifier: if self.import_instance and self.import_instance.user: self.history_modifier = self.import_instance.user.user_ptr @@ -1189,6 +1191,10 @@ class Importer(object): continue data = update_data(defaults, data) self.validity.append(c_row) + if self.DEBUG: + debug_data = copy.deepcopy(data) + debug_data["_debug_current_line"] = idx_line + 1 + self.debug.append(debug_data) if not self.c_errors and (idx_col + 1) < self.min_col_number: self.c_errors = True self.errors.append( -- cgit v1.2.3