REGRESSSIOSSSOONNNNSSSS
This commit is contained in:
@@ -40,6 +40,15 @@ class HookServerInstance(ThreadingHTTPServer):
|
||||
super().__init__(server_address, RequestHandlerClass)
|
||||
self.app = app
|
||||
|
||||
def _serialize_for_api(obj: Any) -> Any:
|
||||
if hasattr(obj, "to_dict"):
|
||||
return obj.to_dict()
|
||||
if isinstance(obj, list):
|
||||
return [_serialize_for_api(x) for x in obj]
|
||||
if isinstance(obj, dict):
|
||||
return {k: _serialize_for_api(v) for k, v in obj.items()}
|
||||
return obj
|
||||
|
||||
class HookHandler(BaseHTTPRequestHandler):
|
||||
"""Handles incoming HTTP requests for the API hooks."""
|
||||
def do_GET(self) -> None:
|
||||
@@ -184,7 +193,8 @@ class HookHandler(BaseHTTPRequestHandler):
|
||||
try:
|
||||
gettable = _get_app_attr(app, "_gettable_fields", {})
|
||||
for key, attr in gettable.items():
|
||||
result[key] = _get_app_attr(app, attr, None)
|
||||
val = _get_app_attr(app, attr, None)
|
||||
result[key] = _serialize_for_api(val)
|
||||
finally: event.set()
|
||||
lock = _get_app_attr(app, "_pending_gui_tasks_lock")
|
||||
tasks = _get_app_attr(app, "_pending_gui_tasks")
|
||||
|
||||
Reference in New Issue
Block a user