diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-11 20:30:10 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-11 20:30:10 +0200 |
commit | 3b3f4bb167226810a4d323488071bba22ae27621 (patch) | |
tree | e123f0f0d7da4ae81d79c55e5aac54c4f554d29c | |
parent | 37682adc5ffde5ac5e3ded49fc725c0d18a94be7 (diff) | |
download | Ishtar-3b3f4bb167226810a4d323488071bba22ae27621.tar.bz2 Ishtar-3b3f4bb167226810a4d323488071bba22ae27621.zip |
Import: manage file and image serialization
-rw-r--r-- | ishtar_common/data_importer.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index f8d0ffa6b..a59e7f7a7 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1689,7 +1689,20 @@ class Importer(object): % (str(cls), str("__".join(path)), str(data), message)) + # image field is not serialized + image, associated_file = None, None + if "image" in data and data["image"]: + image = data.pop("image") + if "associated_file" in data and data["associated_file"]: + associated_file = data.pop("associated_file") create_dict = copy.deepcopy(data) + if image: + data["image"] = image + create_dict["image"] = image + if associated_file: + data["associated_file"] = associated_file + create_dict["associated_file"] = associated_file + for k in list(create_dict.keys()): # filter unnecessary default values but not the json field if isinstance(create_dict[k], dict) and k != 'data': |