diff options
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 |
commit | 850fb3b058a729437daa38d43ba46064bd686c0c (patch) | |
tree | 51067bbe4ac2bb44a139c2bc813d1442d2db4582 /archaeological_finds/wizards.py | |
parent | 4c99f2d8afcfdb6104edc679ec9b7fce81ceec0c (diff) | |
download | Ishtar-850fb3b058a729437daa38d43ba46064bd686c0c.tar.bz2 Ishtar-850fb3b058a729437daa38d43ba46064bd686c0c.zip |
Treatments: better management of merge - tests
Diffstat (limited to 'archaeological_finds/wizards.py')
-rw-r--r-- | archaeological_finds/wizards.py | 12 |
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): |