From 2affc6d38b5e89f01b3438339aea423d1bede92b Mon Sep 17 00:00:00 2001 From: Alek Storm Date: Wed, 17 Aug 2011 00:19:40 +0000 Subject: [PATCH] Add 'static_handler_args' application setting to pass extra keyword arguments to static file handler constructor. --- tornado/web.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tornado/web.py b/tornado/web.py index 384b26eec..94e72999c 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -1199,12 +1199,12 @@ class Application(object): "/static/") static_handler_class = settings.get("static_handler_class", StaticFileHandler) - handlers = [ - (re.escape(static_url_prefix) + r"(.*)", static_handler_class, - dict(path=path)), - (r"/(favicon\.ico)", static_handler_class, dict(path=path)), - (r"/(robots\.txt)", static_handler_class, dict(path=path)), - ] + handlers + static_handler_args = settings.get("static_handler_args", {}) + static_handler_args['path'] = path + for pattern in [re.escape(static_url_prefix) + r"(.*)", + r"/(favicon\.ico)", r"/(robots\.txt)"]: + handlers.insert(0, (pattern, static_handler_class, + static_handler_args)) if handlers: self.add_handlers(".*$", handlers) # Automatically reload modified modules -- 2.47.2