Merge pull request #4303 from pgjones/cpy_ensure

`copy_current_request_context` can decorate async functions
This commit is contained in:
David Lord 2021-11-16 06:34:30 -08:00 committed by GitHub
commit 04c6a85518
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)