From: Ben Darnell Date: Sat, 1 Jun 2013 00:03:02 +0000 (-0400) Subject: Doc patch for 3.0: replace @gen.coroutine with @gen.engine. X-Git-Tag: v3.0.2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57eb740c8c608c0504f71af419a9bf2a649fca6a;p=thirdparty%2Ftornado.git Doc patch for 3.0: replace @gen.coroutine with @gen.engine. The oauth 1.0 redirect methods are asynchronous even though they don't take a callback, so we don't want the end of the coroutine to trigger a call to self.finish. --- diff --git a/tornado/auth.py b/tornado/auth.py index fddbad6cb..c8686187f 100644 --- a/tornado/auth.py +++ b/tornado/auth.py @@ -37,7 +37,7 @@ Example usage for Google OpenID:: class GoogleLoginHandler(tornado.web.RequestHandler, tornado.auth.GoogleMixin): @tornado.web.asynchronous - @tornado.gen.coroutine + @tornado.gen.engine def get(self): if self.get_argument("openid.mode", None): user = yield self.get_authenticated_user() @@ -572,7 +572,7 @@ class TwitterMixin(OAuthMixin): class TwitterLoginHandler(tornado.web.RequestHandler, tornado.auth.TwitterMixin): @tornado.web.asynchronous - @tornado.gen.coroutine + @tornado.gen.engine def get(self): if self.get_argument("oauth_token", None): user = yield self.get_authenticated_user() @@ -627,7 +627,7 @@ class TwitterMixin(OAuthMixin): tornado.auth.TwitterMixin): @tornado.web.authenticated @tornado.web.asynchronous - @tornado.gen.coroutine + @tornado.gen.engine def get(self): new_entry = yield self.twitter_request( "/statuses/update", @@ -706,7 +706,7 @@ class FriendFeedMixin(OAuthMixin): class FriendFeedLoginHandler(tornado.web.RequestHandler, tornado.auth.FriendFeedMixin): @tornado.web.asynchronous - @tornado.gen.coroutine + @tornado.gen.engine def get(self): if self.get_argument("oauth_token", None): user = yield self.get_authenticated_user() @@ -751,7 +751,7 @@ class FriendFeedMixin(OAuthMixin): tornado.auth.FriendFeedMixin): @tornado.web.authenticated @tornado.web.asynchronous - @tornado.gen.coroutine + @tornado.gen.engine def get(self): new_entry = yield self.friendfeed_request( "/entry", @@ -835,7 +835,7 @@ class GoogleMixin(OpenIdMixin, OAuthMixin): class GoogleLoginHandler(tornado.web.RequestHandler, tornado.auth.GoogleMixin): @tornado.web.asynchronous - @tornado.gen.coroutine + @tornado.gen.engine def get(self): if self.get_argument("openid.mode", None): user = yield self.get_authenticated_user() @@ -1105,7 +1105,7 @@ class FacebookGraphMixin(OAuth2Mixin): class FacebookGraphLoginHandler(LoginHandler, tornado.auth.FacebookGraphMixin): @tornado.web.asynchronous - @tornado.gen.coroutine + @tornado.gen.engine def get(self): if self.get_argument("code", False): user = yield self.get_authenticated_user( @@ -1192,7 +1192,7 @@ class FacebookGraphMixin(OAuth2Mixin): tornado.auth.FacebookGraphMixin): @tornado.web.authenticated @tornado.web.asynchronous - @tornado.gen.coroutine + @tornado.gen.engine def get(self): new_entry = yield self.facebook_request( "/me/feed", @@ -1223,7 +1223,7 @@ class FacebookGraphMixin(OAuth2Mixin): def _on_facebook_request(self, future, response): if response.error: - future.set_exception(AuthError("Error response %s fetching %s", + future.set_exception(AuthError("Error response %s fetching %s", response.error, response.request.url)) return