]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Doc patch for 3.0: replace @gen.coroutine with @gen.engine.
authorBen Darnell <ben@bendarnell.com>
Sat, 1 Jun 2013 00:03:02 +0000 (20:03 -0400)
committerBen Darnell <ben@bendarnell.com>
Sat, 1 Jun 2013 00:03:02 +0000 (20:03 -0400)
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.

tornado/auth.py

index fddbad6cb7f0a0c98442bb715001d317437691c4..c8686187f3ec0beb1c4947294d737dff7462c290 100644 (file)
@@ -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