use deco to avoid current_user (#26077)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Asuka Minato
2025-10-16 15:45:51 +09:00
committed by GitHub
parent bd01af6415
commit cced33d068
109 changed files with 526 additions and 788 deletions

View File

@ -22,7 +22,7 @@ def register_external_error_handlers(api: Api):
got_request_exception.send(current_app, exception=e)
# If Werkzeug already prepared a Response, just use it.
if getattr(e, "response", None) is not None:
if e.response is not None:
return e.response
status_code = getattr(e, "code", 500) or 500
@ -106,7 +106,7 @@ def register_external_error_handlers(api: Api):
# Log stack
exc_info: Any = sys.exc_info()
if exc_info[1] is None:
exc_info = None
exc_info = (None, None, None)
current_app.log_exception(exc_info)
return data, status_code

View File

@ -24,7 +24,7 @@ from core.model_runtime.utils.encoders import jsonable_encoder
from extensions.ext_redis import redis_client
if TYPE_CHECKING:
from models.account import Account
from models import Account
from models.model import EndUser
logger = logging.getLogger(__name__)
@ -43,7 +43,7 @@ def extract_tenant_id(user: Union["Account", "EndUser"]) -> str | None:
Raises:
ValueError: If user is neither Account nor EndUser
"""
from models.account import Account
from models import Account
from models.model import EndUser
if isinstance(user, Account):
@ -78,7 +78,7 @@ class AvatarUrlField(fields.Raw):
if obj is None:
return None
from models.account import Account
from models import Account
if isinstance(obj, Account) and obj.avatar is not None:
return file_helpers.get_signed_file_url(obj.avatar)

View File

@ -7,7 +7,7 @@ from flask_login.config import EXEMPT_METHODS # type: ignore
from werkzeug.local import LocalProxy
from configs import dify_config
from models.account import Account
from models import Account
from models.model import EndUser
#: A proxy for the current user. If no user is logged in, this will be an