Permalink
Browse files

Added docstring to asynchronous decorator

  • Loading branch information...
1 parent cdc340b commit 29b2cfebe07bd005c1526870eb7f05ba1d5368c7 @acasajus committed Oct 4, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 tornado/web.py
View
@@ -1163,6 +1163,19 @@ def _on_download(self, response):
self.write("Downloaded!")
self.finish()
+ This decorator also allows to execute the prepare method asynchronously.
+ The request handler has to call self.end_prepare() to continue the request
+ processing.
+
+ class MyRequestHandler(web.RequestHandler):
+ @web.asynchronous
+ def prepare(self):
+ doSomeStuff( "somevalue" , callback = self._on_done)
+
+ def _on_done(self):
+ #This is the end of prepare
+ self.end_prepare()
+
"""
@functools.wraps(method)
def wrapper(self, *args, **kwargs):

0 comments on commit 29b2cfe

Please sign in to comment.