chore: proper current_app.config proxy usage (#34345)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Maxime Beauchemin
2025-07-31 19:27:42 -07:00
committed by GitHub
parent 6c9cda758a
commit cb27d5fe8d
144 changed files with 1428 additions and 1119 deletions

View File

@@ -158,6 +158,7 @@ def set_app_error_handlers(app: Flask) -> None: # noqa: C901
@app.errorhandler(HTTPException)
def show_http_exception(ex: HTTPException) -> FlaskResponse:
logger.warning("HTTPException", exc_info=True)
if (
"text/html" in request.accept_mimetypes
and not app.config["DEBUG"]
@@ -185,6 +186,7 @@ def set_app_error_handlers(app: Flask) -> None: # noqa: C901
or SupersetErrorsException, with a specific status code and error type
"""
logger.warning("CommandException", exc_info=True)
if "text/html" in request.accept_mimetypes and not app.config["DEBUG"]:
path = files("superset") / "static/assets/500.html"
return send_file(path, max_age=0), 500
@@ -208,6 +210,7 @@ def set_app_error_handlers(app: Flask) -> None: # noqa: C901
"""Catch-all, to ensure all errors from the backend conform to SIP-40"""
logger.warning("Exception", exc_info=True)
logger.exception(ex)
if "text/html" in request.accept_mimetypes and not app.config["DEBUG"]:
path = files("superset") / "static/assets/500.html"
return send_file(path, max_age=0), 500