1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

Merge pull request #1318 from dmach/fix-xmlindent-elementtree

Fix core.xmlindent() to work with ElementTree objects
This commit is contained in:
Daniel Mach 2023-05-09 16:14:17 +02:00 committed by GitHub
commit f224926125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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