Refactor utils.py as a helper class so we have some control about when the lookup services actually start

This commit is contained in:
Ian Renton
2025-10-13 20:16:40 +01:00
parent 9d2b2a1f66
commit cfa3aaedb0
6 changed files with 431 additions and 412 deletions

View File

@@ -9,7 +9,6 @@ from bottle import run, request, response, template
from core.config import MAX_SPOT_AGE, ALLOW_SPOTTING
from core.constants import BANDS, ALL_MODES, MODE_TYPES, SIGS, CONTINENTS
from core.utils import serialize_everything
from data.spot import Spot
@@ -252,3 +251,10 @@ class WebServer:
options["spot_sources"].append("API")
return options
# Convert objects to serialisable things. Used by JSON serialiser as a default when it encounters unserializable things.
# 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):
return obj.__dict__