From d3c96dbb05352d417ca2f88797e6ae44534e7f86 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 25 Sep 2015 13:43:13 +0200 Subject: Imports: manage boolean association on DB --- ishtar_common/data_importer.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'ishtar_common/data_importer.py') diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 19746315a..16d9ce8d8 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -408,18 +408,11 @@ class StrToBoolean(Formater, ChoiceChecker): self.missings = set() if self.db_target: for target_key in self.db_target.keys.filter(is_set=True).all(): - value = target_key.value - value = self.prepare(value) - if value in self.dct: + key = self.prepare(target_key.key) + if key in self.dct: continue - v = target_key.key - if v in ('False', '0'): - v = False - elif v: - v = True - else: - v = None - self.dct[value] = v + v = target_key.format() + self.dct[key] = v self.new_keys = {} def prepare(self, value): -- cgit v1.2.3