forked from platypush/platypush
Support for implicit serialization of Enum values in JSONAble.
This commit is contained in:
parent
a71017df33
commit
89d85baa6d
1 changed files with 4 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
from abc import ABC, abstractmethod
|
||||
import decimal
|
||||
import datetime
|
||||
from enum import Enum
|
||||
import io
|
||||
import logging
|
||||
import inspect
|
||||
|
@ -71,6 +72,9 @@ class Message:
|
|||
if isinstance(obj, JSONAble):
|
||||
return obj.to_json()
|
||||
|
||||
if isinstance(obj, Enum):
|
||||
return obj.value
|
||||
|
||||
# Don't serialize I/O wrappers/objects
|
||||
if isinstance(obj, io.IOBase):
|
||||
return None
|
||||
|
|
Loading…
Reference in a new issue