From 63635368531d22468019d7afc60d5edc076f427b Mon Sep 17 00:00:00 2001 From: Christian Duvholt Date: Sun, 19 Jun 2016 19:54:14 +0200 Subject: [PATCH] Use a python 2.6 friendly way to iterate over elements --- wiki/core/markdown/mdx/responsivetable.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wiki/core/markdown/mdx/responsivetable.py b/wiki/core/markdown/mdx/responsivetable.py index 2b031bf4..48d7df49 100644 --- a/wiki/core/markdown/mdx/responsivetable.py +++ b/wiki/core/markdown/mdx/responsivetable.py @@ -14,7 +14,7 @@ class ResponsiveTableExtension(markdown.Extension): class ResponsiveTableTree(Treeprocessor): def run(self, root): - for table_wrapper in root.findall('.//table'): + for table_wrapper in list(root.getiterator('table')): table_new = self.create_table_element() self.convert_to_wrapper(table_wrapper) self.move_children(table_wrapper, table_new) @@ -30,10 +30,10 @@ class ResponsiveTableTree(Treeprocessor): def move_children(self, element1, element2): """Moves children from element1 to element2""" - for child in element1: + for child in element1.getchildren(): element2.append(child) # reversed is needed to safely remove items while iterating - for child in reversed(element1): + for child in reversed(element1.getchildren()): element1.remove(child) def convert_to_wrapper(self, element): -- 2.45.2