From: Tony Mack Date: Mon, 31 Oct 2011 13:35:30 +0000 (-0400) Subject: updated Xml.todict() X-Git-Tag: sfa-1.1-2~17^2~4 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=83c1e26a791e151cfcfef37d76444ba66f40697f updated Xml.todict() --- diff --git a/sfa/util/record.py b/sfa/util/record.py index 424f4195..7ebf379a 100644 --- a/sfa/util/record.py +++ b/sfa/util/record.py @@ -319,7 +319,7 @@ class SfaRecord(Row): #dict = xmlrpclib.loads(str)[0][0] record = XML(str) - self.load_from_dict(record.todict2()) + self.load_from_dict(record.todict()) ## # Dump the record to stdout diff --git a/sfa/util/xml.py b/sfa/util/xml.py index d880ed3c..0ef71d96 100755 --- a/sfa/util/xml.py +++ b/sfa/util/xml.py @@ -216,20 +216,8 @@ class XML: def toxml(self): return etree.tostring(self.root, encoding='UTF-8', pretty_print=True) - def todict(self, elem=None): - if elem is None: - elem = self.root - d = {} - d.update(elem.attrib) - d['text'] = elem.text - for child in elem.iterchildren(): - if child.tag not in d: - d[child.tag] = [] - d[child.tag].append(self.todict(child)) - return d - # XXX smbaker, for record.load_from_string - def todict2(self, elem=None): + def todict(self, elem=None): if elem is None: elem = self.root d = {}