Module events now working

This commit is contained in:
Némunaire 2012-06-20 16:24:19 +02:00
parent 61ac7b11f5
commit d9eab146e6
3 changed files with 116 additions and 204 deletions

View file

@ -41,7 +41,10 @@ class ModuleState:
if isinstance(self.attributes[name], datetime):
return self.attributes[name]
else:
return date.fromtimestamp(float(self.attributes[name]))
try:
return datetime.fromtimestamp(float(self.attributes[name]))
except ValueError:
return datetime.fromtimestamp(time.mktime(time.strptime(self.attributes[name][:19], "%Y-%m-%d %H:%M:%S")))
else:
return None