Created
April 26, 2013 23:21
-
-
Save whardier/5471074 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseHandler(tornado.web.RequestHandler): | |
# ... | |
@tornado.gen.coroutine | |
def verify_place_something(self): | |
motor_db = self.settings['motor_db'] | |
cursor = motor_db.places.find( | |
# ... | |
limit = 1, | |
) | |
while (yield cursor.fetch_next): | |
geolocation = cursor.next_object() | |
raise tornado.gen.Return(geolocation) | |
class MainHandler(BaseHandler): | |
@tornado.web.asynchronous | |
@tornado.gen.coroutine | |
def get(self): | |
geolocation = (yield self.verify_place_something()) | |
self.render('index.html') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment