Skip to content

Commit

Permalink
tornado 3.x.x does not have tornado.concurrent.is_future
Browse files Browse the repository at this point in the history
  • Loading branch information
hfaran committed Nov 21, 2014
1 parent e3576c9 commit d1a6ea1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tornado_json/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

from functools import wraps
from tornado import gen
from tornado.concurrent import Future
try:
from tornado.concurrent import is_future
except ImportError:
# For tornado 3.x.x
is_future = lambda x: isinstance(x, Future)

from tornado_json.utils import container

Expand Down Expand Up @@ -61,7 +67,7 @@ def _wrapper(self, *args, **kwargs):
output = rh_method(self, *args, **kwargs)
# If the rh_method returned a Future a la `raise Return(value)`
# we grab the output.
if gen.is_future(output):
if is_future(output):
output = yield output

if output_schema is not None:
Expand Down

0 comments on commit d1a6ea1

Please sign in to comment.