Explorar el Código

Update model.py

Correction of JSON serializing bugs with event's details of 1.0 events
pull/52/head
SpeedCode hace 2 años
padre
commit
8a8544fdcd
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. +6
    -0
      kosmorrolib/model.py

+ 6
- 0
kosmorrolib/model.py Ver fichero

@@ -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,


Cargando…
Cancelar
Guardar