--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
There's no way to turn prepare() or get_current_user() async. (I hear rumblings from Ben that Tornado will soon allow them to be treated as async if they return a Future.)
I'd love if RequestHandler.make_static_url checked whether static_handler_class.make_static_url had returned a Future, and if so yielded it.
Background: Motor has a GridFSHandler that's like Tornado's StaticFileHandler but serves files from MongoDB instead of the file system. MongoDB actually tracks the file's MD5 within the database server, so Motor can (asynchronously) retrieve the MD5 from MongoDB instead of computing it from Python.But I believe this would require some major surgery on tornado.template, because the ultimate goal is for template expressions like:{{ static_url('foo') }}...to be optionally async, so motor.GridFSHandler can asynchronously retrieve the MD5 from MongoDB.
Oh, I see. It looks to me like your code will still create multiple MotorClients, when there should be exactly one MotorClient for your entire program. One.
As for the segfault, that can be a symptom of using C extensions from the bson or pymongo modules that were compiled for a different Python version; try uninstalling and reinstalling pymongo.
On Sun, May 12, 2013 at 10:53 AM, A. Jesse Jiryu Davis <je...@emptysquare.net> wrote:
There's no way to turn prepare() or get_current_user() async. (I hear rumblings from Ben that Tornado will soon allow them to be treated as async if they return a Future.)Just prepare(), actually. get_current_user cannot be made asynchronous because its ultimate purpose is to lazily populate self.current_user inside getattr, so it has to be synchronous. However, with the (also brand new) ability to assign to self.current_user you can simply set the current user in an asynchronous prepare method:@gen.coroutinedef prepare(self):self.current_user = yield db.fetch(...)
I've just checked in support for asynchronous prepare() (and as an added bonus, the @asynchronous decorator is no longer necessary on get/post/etc methods if those methods are using @gen.coroutine or @return_future). Are there other methods besides prepare that should get the same treatment?
Hi Jesse,
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornado+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.