1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 10:16:14 +01:00

Fix core.xmlindent() to work with ElementTree objects

This commit is contained in:
Daniel Mach 2023-05-09 08:42:53 +02:00
parent ba1b3c791b
commit c8f2ae1ae6

View File

@ -636,6 +636,8 @@ class DirectoryServiceinfo:
def xmlindent(elem, level=0): def xmlindent(elem, level=0):
i = "\n" + level * " " i = "\n" + level * " "
if isinstance(elem, ET.ElementTree):
elem = elem.getroot()
if len(elem): if len(elem):
if not elem.text or not elem.text.strip(): if not elem.text or not elem.text.strip():
elem.text = i + " " elem.text = i + " "