split api and driver
[sfa.git] / sfa / util / xml.py
index 8f51ce3..1abdad7 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]
@@ -136,7 +139,7 @@ class XML:
 
     def add_element(self, name, attrs={}, parent=None, text=""):
         """
-        Generic wrapper around etree.SubElement(). Adds an element to 
+        Wrapper around etree.SubElement(). Adds an element to 
         specified parent node. Adds element to root node is parent is 
         not specified. 
         """