Skip to content

Commit

Permalink
py26 compat fix
Browse files Browse the repository at this point in the history
  • Loading branch information
staffanm committed Mar 24, 2016
1 parent 7ec9ea4 commit d7e6d57
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ferenda/wordreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ def word_to_docbook(self, indoc, outdoc):
"Docbook conversion failed: %s" % stderr.strip())

tree = ET.parse(tmpfile)
for element in tree.iter():
if hasattr(tree, 'iter'):
iterator = tree.iter()
else:
# Python 2.6 way -- results in a PendingDeprecationWarning
# on newer pythons.
iterator = tree.getiterator()
for element in iterator:
if element.text and element.text.strip() != "":
replacement = ""
for p in element.text.split("\n"):
Expand Down

0 comments on commit d7e6d57

Please sign in to comment.