add_ctx
Wraps a function to ensure the current Flask application context is passed as the first positional argument if it is not already present.
def add_ctx(
f: F
) - > F
Ensures that the current Flask application context is passed as the first positional argument to the decorated function.
Parameters
| Name | Type | Description |
|---|---|---|
| f | F | The function to be decorated, which expects a Flask application context as one of its arguments. |
Returns
| Type | Description |
|---|---|
F | A wrapped version of the original function that automatically injects the current application context if it is missing from the arguments. |