Browse Source

Update model.py

Correction of JSON serializing bugs with event's details of 1.0 events
pull/52/head
SpeedCode 2 years ago
parent
commit
8a8544fdcd
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      kosmorrolib/model.py

+ 6
- 0
kosmorrolib/model.py View File

@@ -252,6 +252,12 @@ class Event(Serializable):
return tuple(object.name for object in self.objects)

def serialize(self) -> dict:
if self.details is not None:
for key, value in self.details.items():
if str(type(value)).startswith("<enum"):
self.details[key] = value.name
elif str(type(value)) == "<class 'datetime.datetime'>":
self.details[key] = value.isoformat()
return {
"objects": [object.serialize() for object in self.objects],
"EventType": self.event_type.name,


Loading…
Cancel
Save