]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Remove references to async_callback from documentation
authorBen Darnell <ben@bendarnell.com>
Tue, 28 Sep 2010 22:46:21 +0000 (15:46 -0700)
committerBen Darnell <ben@bendarnell.com>
Tue, 28 Sep 2010 22:46:21 +0000 (15:46 -0700)
tornado/web.py
website/templates/documentation.txt

index a5bdb876cdba558f28f3460bfe4c69595cf5082a..09ea49ab5ca5d74e0b17edc40e35b96718b02d24 100644 (file)
@@ -780,9 +780,9 @@ class RequestHandler(object):
             return base + static_url_prefix + path
 
     def async_callback(self, callback, *args, **kwargs):
-        """Wrap callbacks with this if they are used on asynchronous requests.
+        """Obsolete - catches exceptions from the wrapped function.
 
-        Catches exceptions and properly finishes the request.
+        This function is unnecessary since Tornado 1.1.
         """
         if callback is None:
             return None
index 45cab52a11182ce901337c17ec423201835c5e56..a7a58578ea7bcf0854b139e3b9e336dc9f9d8dd1 100644 (file)
@@ -711,7 +711,7 @@ Tornado's built-in asynchronous HTTP client:
         def get(self):
             http = tornado.httpclient.AsyncHTTPClient()
             http.fetch("http://friendfeed-api.com/v2/feed/bret",
-                       callback=self.async_callback(self.on_response))
+                       callback=self.on_response)
 
         def on_response(self, response):
             if response.error: raise tornado.web.HTTPError(500)
@@ -724,13 +724,6 @@ When `get()` returns, the request has not finished. When the HTTP client
 eventually calls `on_response()`, the request is still open, and the response
 is finally flushed to the client with the call to `self.finish()`.
 
-If you make calls to asynchronous library functions that require a callback
-(like the HTTP `fetch` function above), you should always wrap your
-callbacks with `self.async_callback`. This simple wrapper ensures that if
-your callback function raises an exception or has a programming error,
-a proper HTTP error response will be sent to the browser, and the connection
-will be properly closed.
-
 For a more advanced asynchronous example, take a look at the `chat` example
 application, which implements an AJAX chat room using
 [long polling](http://en.wikipedia.org/wiki/Push_technology#Long_polling).
@@ -755,7 +748,7 @@ the Google credentials in a cookie for later access:
         @tornado.web.asynchronous
         def get(self):
             if self.get_argument("openid.mode", None):
-                self.get_authenticated_user(self.async_callback(self._on_auth))
+                self.get_authenticated_user(self._on_auth)
                 return
             self.authenticate_redirect()