mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Allow adding spots. Convert timestamps in the API to UNIX seconds. #2
This commit is contained in:
@@ -150,9 +150,7 @@ def infer_mode_from_frequency(freq):
|
||||
|
||||
|
||||
# Convert objects to serialisable things. Used by JSON serialiser as a default when it encounters unserializable things.
|
||||
# Converts datetimes to ISO.
|
||||
# Anything else it tries to convert to a dict.
|
||||
# Just converts objects to dict. Try to avoid doing anything clever here when serialising spots, because we also need
|
||||
# to receive spots without complex handling.
|
||||
def serialize_everything(obj):
|
||||
if isinstance(obj, datetime):
|
||||
return obj.isoformat()
|
||||
return obj.__dict__
|
||||
Reference in New Issue
Block a user