copy_current_request_context can decorate async functions

This commit is contained in:
pgjones 2021-10-16 11:05:56 +01:00 committed by David Lord
parent 6b0c8cdac1
commit 47e4bd5059
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
2 changed files with 4 additions and 1 deletions

View File

@ -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
-------------

View File

@ -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)