Permalink
Browse files

The async_yield wrapper has been simplified and now works with multip…

…le methods on the same handler, and methods that are named the same (parent classes, etc)
  • Loading branch information...
1 parent 1a761d6 commit fdcfb17b4e12ea8ee41cf4bb9db4360e8ac4d79e Jeremy Kelley committed Mar 7, 2011
Showing with 4 additions and 8 deletions.
  1. +3 −7 README.md
  2. +1 −1 setup.py
View
@@ -65,13 +65,13 @@ Or, you can wrap your methods with async_yield...
@async_yield
def some_func(self, callback):
- x = yield some_async_call(callback=mycb('some_func'))
+ x = yield some_async_call(callback=self.yield_cb)
callback(x)
@async_yield
@tornado.web.asynchronous
def get(self):
- ycb = self.mycb('get')
+ ycb = self.yield_cb
retval = yield some_func(ycb)
somedata = 'xxx'
fetchdata = yield AsyncHTTPClient.fetch( 'http://over/there',
@@ -80,11 +80,7 @@ Or, you can wrap your methods with async_yield...
self.write(fetchdata.body if not fetchdata.error else '')
-The @async_yield wrapper doesn't work for every method with callbacks but it
-does cleanup your RequestHandlers quite nicely and really streamlines workflow.
-
-You begin to see the real power of this when you start to have handlers that make
-multiple async calls.
+The @async_yield wrapper works for methods bound to a RequestHandler.
### CushionDBMixin
View
@@ -3,7 +3,7 @@
from distutils.core import setup
setup(name='tornado_addons',
- version='0.01',
+ version='0.02',
description='Tornado Web Add-ons',
author='Jeremy Kelley',
author_email='jeremy@collectivelabs.com',

0 comments on commit fdcfb17

Please sign in to comment.