You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/08/24 16:11:39 UTC
(superset) 01/01: fix(tags): fix broken import in daos/tag.py
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fix/daos-tag-broken-import
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 0e368514d469bf83526d0651f2ac263cb2102c9c
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Mon Aug 24 09:11:07 2026 -0700
fix(tags): fix broken import in daos/tag.py
current_user_can_modify_object moved out of superset.commands.tag.utils,
but daos/tag.py's own import wasn't updated, breaking app boot (ChartRestApi
et al. import this module transitively). Re-point the import at its new
location, lazily inside the function to avoid a circular import between
daos.tag and commands.utils (the latter imports TagDAO from the former).
---
superset/daos/tag.py | 10 +++++-----
tests/unit_tests/tags/commands/update_test.py | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/superset/daos/tag.py b/superset/daos/tag.py
index 139be763347..12d4fe77072 100644
--- a/superset/daos/tag.py
+++ b/superset/daos/tag.py
@@ -21,11 +21,7 @@ from flask import g
from sqlalchemy.exc import NoResultFound
from superset.commands.tag.exceptions import TagNotFoundError
-from superset.commands.tag.utils import (
- current_user_can_modify_object,
- to_object_model,
- to_object_type,
-)
+from superset.commands.tag.utils import to_object_model, to_object_type
from superset.daos.base import BaseDAO
from superset.daos.chart import ChartDAO
from superset.daos.dashboard import DashboardDAO
@@ -349,6 +345,10 @@ class TagDAO(BaseDAO[Tag]):
Returns:
None.
"""
+ # Imported lazily: superset.commands.utils itself imports TagDAO from
+ # this module, so a top-level import here would be circular.
+ from superset.commands.utils import current_user_can_modify_object
+
tagged_objects = []
if not tag:
raise TagNotFoundError()
diff --git a/tests/unit_tests/tags/commands/update_test.py b/tests/unit_tests/tags/commands/update_test.py
index 24a8bd43369..0263968dd9f 100644
--- a/tests/unit_tests/tags/commands/update_test.py
+++ b/tests/unit_tests/tags/commands/update_test.py
@@ -323,7 +323,7 @@ def test_update_command_skips_removal_of_inaccessible_objects(
side_effect=can_modify,
)
mocker.patch(
- "superset.daos.tag.current_user_can_modify_object",
+ "superset.commands.utils.current_user_can_modify_object",
side_effect=can_modify,
)
@@ -397,7 +397,7 @@ def test_update_command_empty_objects_to_tag_only_removes_accessible(
side_effect=can_modify,
)
mocker.patch(
- "superset.daos.tag.current_user_can_modify_object",
+ "superset.commands.utils.current_user_can_modify_object",
side_effect=can_modify,
)