From d2858bc7af3de6f6019b52db868abf2e21f68be5 2011-12-10 15:30:12
From: Timo Paulssen <timonator@perpetuum-immobile.de>
Date: 2011-12-10 15:30:12
Subject: [PATCH] use IPythons config subsystem to allow overrides to the tornado web app.

---

diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py
index e7a00c0..870bfb7 100644
--- a/IPython/frontend/html/notebook/notebookapp.py
+++ b/IPython/frontend/html/notebook/notebookapp.py
@@ -89,6 +89,10 @@ ipython notebook --port=5555 --ip=*    # Listen on port 5555, all interfaces
 
 class NotebookWebApplication(web.Application):
 
+    settings = Dict(config=True,
+            help="Supply overrides for the tornado.web.Application, that the "
+                 "IPython notebook uses.")
+
     def __init__(self, ipython_app, kernel_manager, notebook_manager, log):
         handlers = [
             (r"/", ProjectDashboardHandler),
@@ -111,7 +115,11 @@ class NotebookWebApplication(web.Application):
             cookie_secret=os.urandom(1024),
             login_url="/login",
         )
-        web.Application.__init__(self, handlers, **settings)
+
+        # allow custom overrides for the tornado web app.
+        settings.update(self.settings)
+
+        super(NotebookWebApplication, self).__init__(self, handlers, **settings)
 
         self.kernel_manager = kernel_manager
         self.log = log