Commits

ms2ger  committed bb18249 Merge

Merged in zcorpan/anolis/dont-throw-for-dont-drop-tail-with-filter (pull request #9)

Turns out None + None throws.

  • Participants
  • Parent commits 5ce506b, a7fb551

Comments (0)

Files changed (1)

File anolislib/processes/filter.py

     for element in selector(ElementTree.getroot()):
         previous = element.getprevious()
         parent = element.getparent()
-        if previous != None:
-            previous.tail = previous.tail + element.tail
-        else:
-            parent.text = parent.text + element.tail
+        if element.tail != None:
+            if previous != None:
+                if previous.tail != None:
+                    previous.tail = previous.tail + element.tail
+                else:
+                    previous.tail = element.tail
+            else:
+                if parent.text != None:
+                    parent.text = parent.text + element.tail
+                else:
+                    parent.text = element.tail
         parent.remove(element)