fix error with datetime structs in parse_dict
authorsmbaker <smbaker@fc8clean.lan>
Mon, 31 Oct 2011 01:54:11 +0000 (18:54 -0700)
committersmbaker <smbaker@fc8clean.lan>
Mon, 31 Oct 2011 01:54:11 +0000 (18:54 -0700)
sfa/util/xml.py [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 78e4c6a..89eef9e
@@ -96,8 +96,15 @@ class XML:
             elif isinstance(value, int):
                 d[key] = unicode(d[key])  
             elif value is None:
-                d.pop(key)          
-             
+                d.pop(key)
+
+        # element.attrib.update will explode if DateTimes are in the
+        # dcitionary.
+        d=d.copy()
+        for k in d.keys():
+            if (type(d[k]) != str) and (type(d[k]) != unicode):
+                del d[k]
+
         element.attrib.update(d)
 
     def validate(self, schema):