summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-08-24 18:02:40 -0700
committerZac Medico <zmedico@gentoo.org>2011-08-24 18:02:40 -0700
commitf4d5667a09cb308f30bb7eb5ee14b9ef061c3604 (patch)
treeba13d41463c309077bfd1599dab9928bba219140
parent4a4912dfcec973fc849d7e1326fb3309b5142228 (diff)
downloadportage-f4d5667a09cb308f30bb7eb5ee14b9ef061c3604.tar.gz
portage-f4d5667a09cb308f30bb7eb5ee14b9ef061c3604.tar.bz2
portage-f4d5667a09cb308f30bb7eb5ee14b9ef061c3604.zip
ElementTree: use iter if available (bug #380565)
-rw-r--r--pym/portage/xml/metadata.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pym/portage/xml/metadata.py b/pym/portage/xml/metadata.py
index 7acc1f3d6..090d2c0b3 100644
--- a/pym/portage/xml/metadata.py
+++ b/pym/portage/xml/metadata.py
@@ -217,7 +217,12 @@ class MetaDataXML(object):
if herd in ('no-herd', 'maintainer-wanted', 'maintainer-needed'):
return None
- for node in self._herdstree.getiterator('herd'):
+ try:
+ iterate = self._herdstree.iter
+ except AttributeError:
+ iterate = self._herdstree.getiterator
+
+ for node in iterate('herd'):
if node.findtext('name') == herd:
return node.findtext('email')
@@ -292,8 +297,12 @@ class MetaDataXML(object):
if self._xml_tree is None:
self._useflags = tuple()
else:
+ try:
+ iterate = self._xml_tree.iter
+ except AttributeError:
+ iterate = self._xml_tree.getiterator
self._useflags = tuple(_Useflag(node) \
- for node in self._xml_tree.getiterator('flag'))
+ for node in iterate('flag'))
return self._useflags