From: smbaker Date: Mon, 31 Oct 2011 01:54:11 +0000 (-0700) Subject: fix error with datetime structs in parse_dict X-Git-Tag: sfa-1.1-3~97 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=aaf75e44bd9413d4c7d0ebdb587423e6e43f7f31 fix error with datetime structs in parse_dict --- diff --git a/sfa/util/xml.py b/sfa/util/xml.py old mode 100755 new mode 100644 index 78e4c6a2..89eef9e0 --- a/sfa/util/xml.py +++ b/sfa/util/xml.py @@ -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):