From 08e5ba5da8d85cc22ed55d34663b61a6be470579 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Tue, 16 Nov 2010 16:30:51 -0800 Subject: [PATCH] Add address parameter to Application.listen to match HTTPServer.listen --- tornado/web.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tornado/web.py b/tornado/web.py index beb1457c..dd08dddb 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -1027,14 +1027,15 @@ class Application(object): import autoreload autoreload.start() - def listen(self, port, **kwargs): + def listen(self, port, address="", **kwargs): """Starts an HTTP server for this application on the given port. This is a convenience alias for creating an HTTPServer object - and calling its listen method. Keyword arguments are passed to - the HTTPServer constructor. For advanced uses (e.g. preforking), - do not use this method; create an HTTPServer and call its - bind/start methods directly. + and calling its listen method. Keyword arguments not + supported by HTTPServer.listen are passed to the HTTPServer + constructor. For advanced uses (e.g. preforking), do not use + this method; create an HTTPServer and call its bind/start + methods directly. Note that after calling this method you still need to call IOLoop.instance().start() to start the server. @@ -1043,7 +1044,7 @@ class Application(object): # is not importable on appengine from tornado.httpserver import HTTPServer server = HTTPServer(self, **kwargs) - server.listen(port) + server.listen(port, address) def add_handlers(self, host_pattern, host_handlers): """Appends the given handlers to our handler list.