mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
chore: proper current_app.config proxy usage (#34345)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
6c9cda758a
commit
cb27d5fe8d
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user