From ff841b81d4a3419eb7d996c5240f12dec8e672bc Mon Sep 17 00:00:00 2001 From: Daniel Abdi Date: Wed, 29 Mar 2023 13:27:38 +0000 Subject: [PATCH] Use valuea less frequently. --- ush/python_utils/config_parser.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ush/python_utils/config_parser.py b/ush/python_utils/config_parser.py index 5619cf2197..2d74762285 100644 --- a/ush/python_utils/config_parser.py +++ b/ush/python_utils/config_parser.py @@ -407,7 +407,10 @@ def xml_to_dict(root, return_string): cfg[k] = value else: cfg_l = {} - if value is None: + cfg_l.update({"attrib": child.attrib}) + if isinstance(value, dict): + cfg_l.update(value) + elif value is None: cfg_l.update({"attrib": child.attrib}) else: cfg_l.update({"attrib": child.attrib, "valuea": value}) @@ -441,7 +444,7 @@ def dict_to_xml(d, elem): if isinstance(va, dict): dict_to_xml(va, child) else: - child.text = list_to_str(v, True) + child.text = list_to_str(va, True) elem.append(child) else: child = ET.Element(k)