mirror of https://github.com/pallets/flask.git
copy_current_request_context can decorate async functions
This commit is contained in:
parent
6b0c8cdac1
commit
47e4bd5059
|
@ -29,6 +29,9 @@ Unreleased
|
|||
- ``add_etags`` is renamed to ``etag``.
|
||||
- ``filename`` is renamed to ``path``.
|
||||
|
||||
- ``copy_current_request_context`` can decorate async functions.
|
||||
:pr:`4303`
|
||||
|
||||
|
||||
Version 2.0.3
|
||||
-------------
|
||||
|
|
|
@ -169,7 +169,7 @@ def copy_current_request_context(f: t.Callable) -> t.Callable:
|
|||
|
||||
def wrapper(*args, **kwargs):
|
||||
with reqctx:
|
||||
return f(*args, **kwargs)
|
||||
return reqctx.app.ensure_sync(f)(*args, **kwargs)
|
||||
|
||||
return update_wrapper(wrapper, f)
|
||||
|
||||
|
|
Loading…
Reference in New Issue