瀏覽代碼

Update model.py

Correction of JSON serializing bugs with event's details of 1.0 events
pull/52/head
SpeedCode 2 年之前
父節點
當前提交
8a8544fdcd
共有 1 個檔案被更改,包括 6 行新增0 行删除
  1. +6
    -0
      kosmorrolib/model.py

+ 6
- 0
kosmorrolib/model.py 查看文件

@@ -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…
取消
儲存