Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1078 from Lukas1818/master
remove deprecated getchildren()
  • Loading branch information
Thomas Kowaliczek-Schmer committed Feb 19, 2021
2 parents 790e7cb + cf295fd commit 78c07b9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions engine/python/fife/extensions/serializers/simplexml.py
Expand Up @@ -200,7 +200,7 @@ def get(self, module, name, defaultValue=None):
#get the module tree: for example find tree under module FIFE
moduleTree = self._getModuleTree(module)
element = None
for e in moduleTree.getchildren():
for e in moduleTree:
if e.tag == "Setting" and e.get("name", "") == name:
element = e
break
Expand Down Expand Up @@ -275,7 +275,7 @@ def set(self, module, name, value, extra_attrs={}):
e_type = "str"
value = str(value)

for e in moduleTree.getchildren():
for e in moduleTree:
if e.tag != "Setting": continue
if e.get("name", "") == name:
e.text = value
Expand Down Expand Up @@ -305,7 +305,7 @@ def remove(self, module, name):

moduleTree = self._getModuleTree(module)

for e in moduleTree.getchildren():
for e in moduleTree:
if e.tag != "Setting": continue
if e.get("name", "") == name:
moduleTree.remove(e)
Expand All @@ -321,7 +321,7 @@ def getModuleNameList(self):
self._initialized = True

moduleNames = []
for c in self._root_element.getchildren():
for c in self._root_element:
if c.tag == "Module":
name = c.get("name","")
if not isinstance(name, basestring):
Expand All @@ -344,7 +344,7 @@ def getAllSettings(self, module):

# now from the tree read every value, and put the necessary values
# to the list
for e in moduleTree.getchildren():
for e in moduleTree:
if e.tag == "Setting":
name = e.get("name", "")

Expand Down Expand Up @@ -383,15 +383,15 @@ def _validateTree(self):
Raises an InvalidFormat exception if there is a format error.
"""
for c in self._root_element.getchildren():
for c in self._root_element:
if c.tag != "Module":
raise InvalidFormat("Invalid tag in " + self._file + \
". Expected Module, got: " + c.tag)
elif c.get("name", "") == "":
raise InvalidFormat("Invalid tag in " + self._file + \
". Module name is empty.")
else:
for e in c.getchildren():
for e in c:
if e.tag != "Setting":
raise InvalidFormat("Invalid tag in " + self._file + \
" in module: " + c.tag + \
Expand All @@ -414,7 +414,7 @@ def _getModuleTree(self, module):
raise AttributeError("Settings:_getModuleTree: Invalid type for "
"module argument.")

for c in self._root_element.getchildren():
for c in self._root_element:
if c.tag == "Module" and c.get("name", "") == module:
return c

Expand Down

0 comments on commit 78c07b9

Please sign in to comment.