There's a branch of Twisted that implements this, hopefully it will
eventually be merged: http://twistedmatrix.com/trac/ticket/3711
Is there anything that is currently holding this up? (ie. is the design on this branch what will end up in the system or could it change dramatically?)
There are a bunch of review comments in the ticket. You could just write your own until this is ready, I've done it a number of times and it's a pretty small piece of code.
I started writing one of my own today (basically a wrapper in render_GET that calls an deferrable render_GET). Something like this: def _bg_GET(self, request): # Do something slow request.write(result) return request def render_GET(self, request): d = deferToThread(self._bg_GET, request) d.addCallback(lambda r: r.finish()) return NOT_DONE_YET That seems to work, but I would like to a) not use the deferToThread() and b) do something that doesn't sacrifice too much performance. At the end of the day, what I would really like is something in render_GET that checks the return from calling the internal GET method and if it is a deferred it adds a callback to finish the request, if not it simply returns the result. (this would allow me to use deferToThread, inlineCallbacks, etc as needed in my get methods) Can you see any issues with doing something like this? (it seems almost too simple so I expect that I must be missing something) -Allen