summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-10-23 23:39:36 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-10-23 23:41:54 +0200
commit98d8c6c9be5ad5d8bc979a9acdd3bc872e12cedb (patch)
tree23a18b7f1a101654e0961c723b39dbea44ee35bd
parentde73ab4b5b12a415f9945f322c77ec0bda230a32 (diff)
downloadIshtar-98d8c6c9be5ad5d8bc979a9acdd3bc872e12cedb.tar.bz2
Ishtar-98d8c6c9be5ad5d8bc979a9acdd3bc872e12cedb.zip
Imports: fix dict merge on data update
-rw-r--r--CHANGES.md9
-rw-r--r--ishtar_common/tests.py8
-rw-r--r--ishtar_common/utils.py2
-rw-r--r--ishtar_common/version.py4
4 files changed, 19 insertions, 4 deletions
diff --git a/CHANGES.md b/CHANGES.md
index 10c3c632d..f31ef9409 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,18 +1,23 @@
---
title: Ishtar changelog
-date: 2022-10-03
+date: 2022-10-23
---
Ishtar changelog
================
+v3.2.9 - 2022-10-23
+-------------------
+
+### Bug fix ###
+- Imports: fix dict merge on data update
+
v3.2.8 - 2022-10-17
-------------------
### Bug fix ###
- Fix quick treatment act modify URL match
-
v3.2.7 - 2022-10-03
-------------------
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index 92c62295f..b80c91c26 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -190,6 +190,14 @@ class UtilsTest(TestCase):
}
res = update_data(data_1, data_2)
self.assertEqual(res, expected)
+ data_1 = {"old": {"youpi": {"plouf": "tralalalère"}}}
+ data_2 = {"tsoin_tsoin": "hop", "old": {"youpi": {"plouf": "nop"}}}
+ expected = {
+ "tsoin_tsoin": "hop",
+ "old": {"youpi": {"plouf": "nop"}}
+ }
+ res = update_data(data_1, data_2)
+ self.assertEqual(res, expected)
def test_move_dict_data(self):
data = {"old": {"daté": "value"}}
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index 137f89469..b7a78a226 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -263,6 +263,8 @@ def update_data(data_1, data_2, merge=False):
if data_2 and not data_1:
return data_2
if not merge:
+ if data_2:
+ return data_2
return data_1
if data_2 and data_2 != data_1:
return data_1 + " ; " + data_2
diff --git a/ishtar_common/version.py b/ishtar_common/version.py
index 6de4cb1d6..021671cc6 100644
--- a/ishtar_common/version.py
+++ b/ishtar_common/version.py
@@ -1,5 +1,5 @@
-# 3.2.7
-VERSION = (3, 2, 7)
+# 3.2.9
+VERSION = (3, 2, 9)
def get_version():