[elbe-devel] [PATCH 3/3] treeutils: make text() return "" when el.text is None

Torben Hohn torben.hohn at linutronix.de
Wed Jul 15 17:35:02 CEST 2020


lxml returns None when there is an empty string between nodes.
This is not expected by text()

Return "" when el.text is None.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/treeutils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/treeutils.py b/elbepack/treeutils.py
index 75a1c8579..9acc35a6d 100644
--- a/elbepack/treeutils.py
+++ b/elbepack/treeutils.py
@@ -52,7 +52,7 @@ class ebase(object):
 
             raise Exception("Cant find path %s" % path)
 
-        return el.text
+        return el.text or ""
 
     @property
     def tag(self):
-- 
2.20.1



More information about the elbe-devel mailing list