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

@@ -20,7 +20,7 @@ from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from flask import current_app
from flask import current_app as app
from superset import security_manager
from superset.tasks.exceptions import ExecutorNotFoundError
@@ -91,17 +91,16 @@ def _adjust_string_with_rls(
def get_dashboard_digest(dashboard: Dashboard) -> str | None:
config = current_app.config
try:
executor_type, executor = get_executor(
executors=config["THUMBNAIL_EXECUTORS"],
executors=app.config["THUMBNAIL_EXECUTORS"],
model=dashboard,
current_user=get_current_user(),
)
except ExecutorNotFoundError:
return None
if func := config["THUMBNAIL_DASHBOARD_DIGEST_FUNC"]:
if func := app.config["THUMBNAIL_DASHBOARD_DIGEST_FUNC"]:
return func(dashboard, executor_type, executor)
unique_string = (
@@ -118,17 +117,16 @@ def get_dashboard_digest(dashboard: Dashboard) -> str | None:
def get_chart_digest(chart: Slice) -> str | None:
config = current_app.config
try:
executor_type, executor = get_executor(
executors=config["THUMBNAIL_EXECUTORS"],
executors=app.config["THUMBNAIL_EXECUTORS"],
model=chart,
current_user=get_current_user(),
)
except ExecutorNotFoundError:
return None
if func := config["THUMBNAIL_CHART_DIGEST_FUNC"]:
if func := app.config["THUMBNAIL_CHART_DIGEST_FUNC"]:
return func(chart, executor_type, executor)
unique_string = f"{chart.params or ''}.{executor}"