From: Zac Medico Date: Thu, 25 Aug 2011 01:02:40 +0000 (-0700) Subject: ElementTree: use iter if available (bug #380565) X-Git-Tag: v2.2.0_alpha52~71 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f4d5667a09cb308f30bb7eb5ee14b9ef061c3604;p=portage.git ElementTree: use iter if available (bug #380565) --- 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