From: Ben Darnell Date: Sun, 18 Mar 2018 21:12:28 +0000 (-0400) Subject: auth: Accept native coroutines in _oauth_get_user_future X-Git-Tag: v5.1.0b1~38^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ae97fdf35bc2b3270eeff899f0f4f3a7aaf54a0;p=thirdparty%2Ftornado.git auth: Accept native coroutines in _oauth_get_user_future --- diff --git a/tornado/auth.py b/tornado/auth.py index 12cf37d89..0f9e2a544 100644 --- a/tornado/auth.py +++ b/tornado/auth.py @@ -502,7 +502,9 @@ class OAuthMixin(object): return access_token = _oauth_parse_response(response.body) - self._oauth_get_user_future(access_token).add_done_callback( + fut = self._oauth_get_user_future(access_token) + fut = gen.convert_yielded(fut) + fut.add_done_callback( functools.partial(self._on_oauth_get_user, access_token, future)) def _oauth_consumer_token(self): @@ -528,6 +530,10 @@ class OAuthMixin(object): For backwards compatibility, the callback-based ``_oauth_get_user`` method is also supported. + .. versionchanged:: 5.1 + + Subclasses may also define this method with ``async def``. + .. deprecated:: 5.1 The ``_oauth_get_user`` fallback is deprecated and support for it