From f4d5667a09cb308f30bb7eb5ee14b9ef061c3604 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 24 Aug 2011 18:02:40 -0700 Subject: [PATCH] ElementTree: use iter if available (bug #380565) --- pym/portage/xml/metadata.py | 13 +++++++++++-- 1 file 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 -- 2.26.2