From 22695ff2489204830937b5e02afa20bde89fa782 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 26 Apr 2010 20:08:05 -0400 Subject: [PATCH] Assume non-web.Application instances are WSGI. --- gunicorn/workers/gtornado.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gunicorn/workers/gtornado.py b/gunicorn/workers/gtornado.py index 1d98c703..a419a1a0 100644 --- a/gunicorn/workers/gtornado.py +++ b/gunicorn/workers/gtornado.py @@ -9,6 +9,7 @@ import sys import tornado.web from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop, PeriodicCallback +from tornado.wsgi import WSGIContainer from gunicorn.workers.base import Worker @@ -46,6 +47,11 @@ class TornadoWorker(Worker): self.ioloop = IOLoop.instance() PeriodicCallback(self.watchdog, 1000, io_loop=self.ioloop).start() + # 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.app) + server = HTTPServer(self.app, io_loop=self.ioloop) server._socket = self.socket server.start(num_processes=1)