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- <laipz8200@outlook.com>
pull/21061/head
-LAN- 11 months ago
parent 132a0d6683
commit f6f864969a
No known key found for this signature in database
GPG Key ID: 6BA0D108DED011FF

@ -23,6 +23,10 @@ def flask_context_manager(
the current user is preserved across context boundaries, and any provided context variables the current user is preserved across context boundaries, and any provided context variables
are set within the new context. 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: Args:
flask_app: The Flask application instance flask_app: The Flask application instance
context_vars: contextvars.Context object containing context variables to be set in the new context context_vars: contextvars.Context object containing context variables to be set in the new context

Loading…
Cancel
Save