summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2012-06-22 08:43:46 +0200
committerFlorian Bruhin <me@the-compiler.org>2012-06-22 08:43:46 +0200
commitffa2274c375801c8df2ac4bee84a1f154bff0ad2 (patch)
treec101819092d4272ea0f940033aba52af2a3152b7
parent572b9287bbfce61bde41b22d88fe281bccac2d58 (diff)
downloadxdd2esi-ffa2274c375801c8df2ac4bee84a1f154bff0ad2.tar.gz
xdd2esi-ffa2274c375801c8df2ac4bee84a1f154bff0ad2.zip
Make _getchildren() in xddlib a function, not a method
-rw-r--r--xddlib.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/xddlib.py b/xddlib.py
index 9648bb0..5d18d3b 100644
--- a/xddlib.py
+++ b/xddlib.py
@@ -101,15 +101,6 @@ class XDDFile:
for subobj in obj.subobjects:
yield subobj
- def _getchildren(self, xmlobject):
- """ Gets the children of an object """
- children = []
- for child in xmlobject:
- childattr = dict(child.attrib)
- if not _is_reserved(childattr):
- children.append(childattr)
- return children
-
def _setobjects(self, tree):
""" Fill objlist with the objects """
# XPath to extract the objects
@@ -122,7 +113,7 @@ class XDDFile:
attributes = dict(xmlobject.attrib)
_setattributes(canobject, attributes)
if len(xmlobject) > 0: # check if the object has subobjects
- for child in self._getchildren(xmlobject):
+ for child in _getchildren(xmlobject):
subobject = canobject.newchild()
_setattributes(subobject, child)
self.objlist.append(canobject)
@@ -344,4 +335,13 @@ def _setattributes(canobj, attributes):
setattr(canobj, canobjectlabel, value)
canobj.convertstate = 'xdd'
+def _getchildren(xmlobject):
+ """ Gets the children of an object """
+ children = []
+ for child in xmlobject:
+ childattr = dict(child.attrib)
+ if not _is_reserved(childattr):
+ children.append(childattr)
+ return children
+