From f6f864969ad8c813ae1247a3f4e31681d6299bf5 Mon Sep 17 00:00:00 2001 From: -LAN- Date: Mon, 16 Jun 2025 17:31:50 +0800 Subject: [PATCH] chore: Adds note on non-recommended usage of context manager Introduces a note in the flask_context_manager function documentation to clarify that while the manager facilitates using current_user across threads and app contexts, directly passing the user in parameters is the preferred approach. Signed-off-by: -LAN- --- api/core/helper/flask_context.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/core/helper/flask_context.py b/api/core/helper/flask_context.py index 4abf7c8c32..6460b8e02f 100644 --- a/api/core/helper/flask_context.py +++ b/api/core/helper/flask_context.py @@ -23,6 +23,10 @@ def flask_context_manager( the current user is preserved across context boundaries, and any provided context variables are set within the new context. + Note: + This manager aims to allow use current_user cross thread and app context, + but it's not the recommend use, it's better to pass user directly in parameters. + Args: flask_app: The Flask application instance context_vars: contextvars.Context object containing context variables to be set in the new context