mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Fix using WSGI handlers with tornado worker
Without this, tornado.web.Application instances could be used as a gunicorn application, but running a standard wsgi callback under the tornado worker would fail. ``self.wsgi`` is the property that may be a tornado.web.Application. The transformed application, whether originally tornado.web.Application or a WSGI callable, should be the argument to HTTPServer. Also, it's probably poor form to be mutating the properties of ``self`` here when a local variable suffices.
This commit is contained in:
parent
d53112bbb2
commit
74f0ecdbbf
@ -48,10 +48,11 @@ class TornadoWorker(Worker):
|
||||
|
||||
# Assume the app is a WSGI callable if its not an
|
||||
# instance of tornardo.web.Application
|
||||
if not isinstance(self.app, tornado.web.Application):
|
||||
self.app = WSGIContainer(self.wsgi)
|
||||
app = self.wsgi
|
||||
if not isinstance(app, tornado.web.Application):
|
||||
app = WSGIContainer(app)
|
||||
|
||||
server = HTTPServer(self.wsgi, io_loop=self.ioloop)
|
||||
server = HTTPServer(app, io_loop=self.ioloop)
|
||||
if hasattr(server, "add_socket"): # tornado > 2.0
|
||||
server.add_socket(self.socket)
|
||||
elif hasattr(server, "_sockets"): # tornado 2.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user