Show More
@@ -134,20 +134,16 b' class NotebookWebApplication(web.Application):' | |||||
134 | cluster_manager, log, |
|
134 | cluster_manager, log, | |
135 | base_project_url, settings_overrides): |
|
135 | base_project_url, settings_overrides): | |
136 |
|
136 | |||
137 | # Load the (URL pattern, handler) tuples for each component. |
|
137 | settings = self.init_settings( | |
138 | handlers = [] |
|
138 | ipython_app, kernel_manager, notebook_manager, cluster_manager, | |
139 | handlers.extend(load_handlers('base.handlers')) |
|
139 | log, base_project_url, settings_overrides) | |
140 |
handlers. |
|
140 | handlers = self.init_handlers(settings) | |
141 | handlers.extend(load_handlers('auth.login')) |
|
141 | ||
142 | handlers.extend(load_handlers('auth.logout')) |
|
142 | super(NotebookWebApplication, self).__init__(handlers, **settings) | |
143 | handlers.extend(load_handlers('notebooks.handlers')) |
|
|||
144 | handlers.extend(load_handlers('kernels.apihandlers')) |
|
|||
145 | handlers.extend(load_handlers('notebooks.apihandlers')) |
|
|||
146 | handlers.extend(load_handlers('clusters.apihandlers')) |
|
|||
147 | handlers.extend([ |
|
|||
148 | (r"/files/(.*)", AuthenticatedFileHandler, {'path' : notebook_manager.notebook_dir}), |
|
|||
149 | ]) |
|
|||
150 |
|
143 | |||
|
144 | def init_settings(self, ipython_app, kernel_manager, notebook_manager, | |||
|
145 | cluster_manager, log, | |||
|
146 | base_project_url, settings_overrides): | |||
151 | # Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and |
|
147 | # Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and | |
152 | # base_project_url will always be unicode, which will in turn |
|
148 | # base_project_url will always be unicode, which will in turn | |
153 | # make the patterns unicode, and ultimately result in unicode |
|
149 | # make the patterns unicode, and ultimately result in unicode | |
@@ -189,15 +185,29 b' class NotebookWebApplication(web.Application):' | |||||
189 |
|
185 | |||
190 | # allow custom overrides for the tornado web app. |
|
186 | # allow custom overrides for the tornado web app. | |
191 | settings.update(settings_overrides) |
|
187 | settings.update(settings_overrides) | |
|
188 | return settings | |||
192 |
|
189 | |||
|
190 | def init_handlers(self, settings): | |||
|
191 | # Load the (URL pattern, handler) tuples for each component. | |||
|
192 | handlers = [] | |||
|
193 | handlers.extend(load_handlers('base.handlers')) | |||
|
194 | handlers.extend(load_handlers('tree.handlers')) | |||
|
195 | handlers.extend(load_handlers('auth.login')) | |||
|
196 | handlers.extend(load_handlers('auth.logout')) | |||
|
197 | handlers.extend(load_handlers('notebooks.handlers')) | |||
|
198 | handlers.extend(load_handlers('kernels.apihandlers')) | |||
|
199 | handlers.extend(load_handlers('notebooks.apihandlers')) | |||
|
200 | handlers.extend(load_handlers('clusters.apihandlers')) | |||
|
201 | handlers.extend([ | |||
|
202 | (r"/files/(.*)", AuthenticatedFileHandler, {'path' : settings['notebook_manager'].notebook_dir}), | |||
|
203 | ]) | |||
193 | # prepend base_project_url onto the patterns that we match |
|
204 | # prepend base_project_url onto the patterns that we match | |
194 | new_handlers = [] |
|
205 | new_handlers = [] | |
195 | for handler in handlers: |
|
206 | for handler in handlers: | |
196 | pattern = url_path_join(base_project_url, handler[0]) |
|
207 | pattern = url_path_join(settings['base_project_url'], handler[0]) | |
197 | new_handler = tuple([pattern] + list(handler[1:])) |
|
208 | new_handler = tuple([pattern] + list(handler[1:])) | |
198 | new_handlers.append(new_handler) |
|
209 | new_handlers.append(new_handler) | |
199 |
|
210 | return new_handlers | ||
200 | super(NotebookWebApplication, self).__init__(new_handlers, **settings) |
|
|||
201 |
|
211 | |||
202 |
|
212 | |||
203 |
|
213 |
General Comments 0
You need to be logged in to leave comments.
Login now