summaryrefslogtreecommitdiff
path: root/archaeological_finds/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-11-28 18:51:28 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-11-28 18:53:28 +0100
commit13531adff386cc09c7f41c02ba7c116575cb6ee1 (patch)
tree51067bbe4ac2bb44a139c2bc813d1442d2db4582 /archaeological_finds/wizards.py
parent1d26a7a62d150d19e659e66515fcda5a40c6c68a (diff)
downloadIshtar-13531adff386cc09c7f41c02ba7c116575cb6ee1.tar.bz2
Ishtar-13531adff386cc09c7f41c02ba7c116575cb6ee1.zip
Treatments: better management of merge - tests
Diffstat (limited to 'archaeological_finds/wizards.py')
-rw-r--r--archaeological_finds/wizards.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/archaeological_finds/wizards.py b/archaeological_finds/wizards.py
index 8ed7061e2..43f48ab59 100644
--- a/archaeological_finds/wizards.py
+++ b/archaeological_finds/wizards.py
@@ -246,12 +246,18 @@ class TreatmentN1Wizard(TreatmentBase):
def _update_char_initial_from_finds(self, initial, find, k, sep=' ; '):
r_k = "resulting_" + k
- if not getattr(find, k):
+ value = getattr(find, k)
+ if not value:
return initial
+ value = value.strip()
if not initial[r_k]:
- initial[r_k] = getattr(find, k)
+ initial[r_k] = value
else:
- initial[r_k] += sep + getattr(find, k)
+ # new value is entirely inside the current value
+ if value == initial[r_k] or (value + sep) in initial[r_k] or \
+ (sep + value) in initial[r_k]:
+ return initial
+ initial[r_k] += sep + value
return initial
def get_form_initial(self, step, data=None):