Skip to main content

add_ctx

No overview available.

def add_ctx(
f: F
) - > F

Wraps a function to ensure that an application context is passed as the first argument if it's not already present or is not an AppContext instance. This is useful for functions that operate within a Flask application context.

Parameters

NameTypeDescription
fFThe function to be wrapped. This function is expected to accept an application context as its first argument.

Returns

TypeDescription
FThe original function f wrapped with the context-adding logic.