Xmlparser module: getNodes is now a generator

This commit is contained in:
nemunaire 2014-10-02 07:03:27 +02:00
parent ada19a221c
commit ce9dec7ed4
2 changed files with 2 additions and 6 deletions

View file

@ -152,15 +152,12 @@ class ModuleState:
def getNodes(self, tagname):
"""Get all direct childs that have the given tagname"""
ret = list()
for child in self.childs:
if tagname is None or tagname == child.name:
ret.append(child)
return ret
yield child
def hasNode(self, tagname):
"""Return True if at least one node with the given tagname exists"""
ret = list()
for child in self.childs:
if tagname is None or tagname == child.name:
return True