[elbe-devel] [PATCH 2/7] elbepack: treeutils: implement tostring() on ebase
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Wed Jul 24 10:01:30 CEST 2024
This method is useful and usable on all kinds of elements.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/treeutils.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/elbepack/treeutils.py b/elbepack/treeutils.py
index ffae4621f508..ad39cb32c67f 100644
--- a/elbepack/treeutils.py
+++ b/elbepack/treeutils.py
@@ -99,6 +99,9 @@ class ebase:
def append_treecopy(self, other):
self.et.append(copy.deepcopy(other.et))
+ def tostring(self):
+ return tostring(self.et, encoding='utf-8').decode('utf-8')
+
class elem(ebase):
@@ -143,9 +146,6 @@ class etree(ebase):
self.et.getroot().tail = '\n'
self.et.write(fname, encoding=encoding)
- def tostring(self):
- return tostring(self.et, encoding='utf-8').decode('utf-8')
-
def ensure_child(self, tag):
retval = self.et.find('./' + tag)
if retval is not None:
--
2.45.2
More information about the elbe-devel
mailing list