summaryrefslogtreecommitdiff
path: root/src/xhtml.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-09-29 23:19:21 +0200
committerFlorent Le Coz <louiz@louiz.org>2011-09-29 23:19:21 +0200
commitc89d9a3aa4cefa881a6347878ec5c940160a1c33 (patch)
treec3c35055f2c7ad40cd9ee058397f56b7e391f19e /src/xhtml.py
parent90699130b9d239dd4a96d09bc98744868138f348 (diff)
downloadpoezio-c89d9a3aa4cefa881a6347878ec5c940160a1c33.tar.gz
poezio-c89d9a3aa4cefa881a6347878ec5c940160a1c33.tar.bz2
poezio-c89d9a3aa4cefa881a6347878ec5c940160a1c33.tar.xz
poezio-c89d9a3aa4cefa881a6347878ec5c940160a1c33.zip
use getiterator if python < 3.2
Diffstat (limited to 'src/xhtml.py')
-rw-r--r--src/xhtml.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/xhtml.py b/src/xhtml.py
index 9bb2705d..c14382b8 100644
--- a/src/xhtml.py
+++ b/src/xhtml.py
@@ -249,7 +249,11 @@ def xhtml_to_poezio_colors(text):
log.debug(text)
xml = ET.fromstring(text)
message = ''
- for elem in xml.iter():
+ if version_info[1] == 2:
+ elems = xml.iter()
+ else:
+ elems = xml.getiterator()
+ for elem in elems:
if elem.tag == '{http://www.w3.org/1999/xhtml}a':
if 'href' in elem.attrib and elem.attrib['href'] != elem.text:
message += '\x19u%s\x19o (%s)' % (trim(elem.attrib['href']), trim(elem.text))