Skip to content

Commit

Permalink
fix indent for py3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dmach committed Jul 7, 2023
1 parent 6ee75fc commit 1674c7e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions osc/obs_api/xmlmodel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def to_bytes(self, validate=True):
"""
Return the object as XML in form of utf-8 encoded bytes.
"""
if validate:
self._pre_save()
ET.indent(self._root, space=" ", level=0)
self._pre_save(validate=validate)
return ET.tostring(self._root, encoding="utf-8", short_empty_elements=True)

def to_string(self, validate=True):
Expand Down Expand Up @@ -123,8 +121,9 @@ def validate(self, what=None):
ex.xml = self.to_string(validate=False)
raise

Check warning on line 122 in osc/obs_api/xmlmodel/models.py

View check run for this annotation

Codecov / codecov/patch

osc/obs_api/xmlmodel/models.py#L120-L122

Added lines #L120 - L122 were not covered by tests

def _pre_save(self):
self.validate()
def _pre_save(self, validate=True):
if validate:
self.validate()
self._sort_nodes()
self._reindent(self._root)
xml.indent(self._root)
Expand Down

0 comments on commit 1674c7e

Please sign in to comment.