Merge branch 'upstreammaster'
[sfa.git] / sfa / util / xml.py
index 0ef71d9..25f1656 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/python 
+from types import StringTypes
 from lxml import etree
 from StringIO import StringIO
 
@@ -101,6 +102,8 @@ class XML:
         # element.attrib.update will explode if DateTimes are in the
         # dcitionary.
         d=d.copy()
+        for (k,v) in d.iteritems():
+            if not isinstance(v,StringTypes): del d[k]
         for k in d.keys():
             if (type(d[k]) != str) and (type(d[k]) != unicode):
                 del d[k]
@@ -226,7 +229,7 @@ class XML:
         for child in elem.iterchildren():
             if child.tag not in d:
                 d[child.tag] = []
-            d[child.tag].append(self.todict2(child))
+            d[child.tag].append(self.todict(child))
 
         if len(d)==1 and ("text" in d):
             d = d["text"]