From 1cfb8bb685b387452e1c3911cb25fa9146e7ecba Mon Sep 17 00:00:00 2001 From: Nicolas Debrigode Date: Tue, 7 Nov 2023 16:48:52 +0100 Subject: [PATCH] fix getchildren with python version >= 3.9 --- .../network/ne/common_module/xml_build_with_xmlns.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module_utils/network/ne/common_module/xml_build_with_xmlns.py b/module_utils/network/ne/common_module/xml_build_with_xmlns.py index a735192..92ec807 100644 --- a/module_utils/network/ne/common_module/xml_build_with_xmlns.py +++ b/module_utils/network/ne/common_module/xml_build_with_xmlns.py @@ -58,9 +58,9 @@ def create_xml_with_xmlns(root, new_xmlns_info_list, all_xpath_without_prefix, d :param dest_xpath: record the path of rebuild :param current_element: the current generate element root """ - if root.getchildren(): + if list(root): # traversing the xml root which need to be rebuild.( always come from instance xml ) - for child_of_root in root.getchildren(): + for child_of_root in list(root): dest_xpath = dest_xpath + "/" + child_of_root.tag # get value from instance xml @@ -133,4 +133,4 @@ def xml_parser_join_xmlns(xml_content, xmlns_info_list, filter_or_config_type): xml_str = ET.tostring(generate_root, method='xml') else: xml_str = ET.tostring(generate_root, method='xml', encoding="utf-8").decode('utf-8') - return xml_str \ No newline at end of file + return xml_str