Xmlparser: check the attribute type is storable

This commit is contained in:
nemunaire 2014-09-19 01:38:53 +02:00
parent dee6ec28fe
commit ae3c46e693
2 changed files with 4 additions and 67 deletions

View file

@ -124,7 +124,10 @@ class ModuleState:
def setAttribute(self, name, value):
"""DOM like method"""
self.attributes[name] = value
if isinstance(value, datetime) or isinstance(value, str) or isinstance(value, int) or isinstance(value, float):
self.attributes[name] = value
else:
raise TypeError("attributes must be primary type or datetime")
def getContent(self):
return self.content