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 | 053001be8bd56573016b7d8d92da557522365a16 (patch) | |
tree | e123f0f0d7da4ae81d79c55e5aac54c4f554d29c /ishtar_common | |
parent | 766b4bc5c613675cb38cb57d596a892bea181577 (diff) | |
download | Ishtar-053001be8bd56573016b7d8d92da557522365a16.tar.bz2 Ishtar-053001be8bd56573016b7d8d92da557522365a16.zip |
Import: manage file and image serialization
Diffstat (limited to 'ishtar_common')
-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': |