]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
auth: Accept native coroutines in _oauth_get_user_future
authorBen Darnell <ben@bendarnell.com>
Sun, 18 Mar 2018 21:12:28 +0000 (17:12 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 18 Mar 2018 21:24:44 +0000 (17:24 -0400)
tornado/auth.py

index 12cf37d896da2627c7b690d30f755375988784dc..0f9e2a544265e2b14bd719a495371e4ee0b21ab3 100644 (file)
@@ -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