Show More
@@ -320,7 +320,7 b' class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler):' | |||||
320 |
|
320 | |||
321 | def set_headers(self): |
|
321 | def set_headers(self): | |
322 | super(AuthenticatedFileHandler, self).set_headers() |
|
322 | super(AuthenticatedFileHandler, self).set_headers() | |
323 |
# disable browser caching, rely |
|
323 | # disable browser caching, rely on 304 replies for savings | |
324 | if "v" not in self.request.arguments: |
|
324 | if "v" not in self.request.arguments: | |
325 | self.add_header("Cache-Control", "no-cache") |
|
325 | self.add_header("Cache-Control", "no-cache") | |
326 |
|
326 | |||
@@ -394,11 +394,14 b' class FileFindHandler(web.StaticFileHandler):' | |||||
394 |
|
394 | |||
395 | def set_headers(self): |
|
395 | def set_headers(self): | |
396 | super(FileFindHandler, self).set_headers() |
|
396 | super(FileFindHandler, self).set_headers() | |
397 |
# disable browser caching, rely |
|
397 | # disable browser caching, rely on 304 replies for savings | |
398 |
if "v" not in self.request.arguments |
|
398 | if "v" not in self.request.arguments or \ | |
|
399 | any(self.request.path.startswith(path) for path in self.no_cache_paths): | |||
399 | self.add_header("Cache-Control", "no-cache") |
|
400 | self.add_header("Cache-Control", "no-cache") | |
400 |
|
401 | |||
401 | def initialize(self, path, default_filename=None): |
|
402 | def initialize(self, path, default_filename=None, no_cache_paths=None): | |
|
403 | self.no_cache_paths = no_cache_paths or [] | |||
|
404 | ||||
402 | if isinstance(path, string_types): |
|
405 | if isinstance(path, string_types): | |
403 | path = [path] |
|
406 | path = [path] | |
404 |
|
407 |
@@ -171,6 +171,10 b' class NotebookWebApplication(web.Application):' | |||||
171 | static_path=ipython_app.static_file_path, |
|
171 | static_path=ipython_app.static_file_path, | |
172 | static_handler_class = FileFindHandler, |
|
172 | static_handler_class = FileFindHandler, | |
173 | static_url_prefix = url_path_join(base_url,'/static/'), |
|
173 | static_url_prefix = url_path_join(base_url,'/static/'), | |
|
174 | static_handler_args = { | |||
|
175 | # don't cache custom.js | |||
|
176 | 'no_cache_paths': [url_path_join(base_url, 'static', 'custom')], | |||
|
177 | }, | |||
174 | version_hash=version_hash, |
|
178 | version_hash=version_hash, | |
175 |
|
179 | |||
176 | # authentication |
|
180 | # authentication | |
@@ -218,8 +222,12 b' class NotebookWebApplication(web.Application):' | |||||
218 | handlers.extend(load_handlers('services.sessions.handlers')) |
|
222 | handlers.extend(load_handlers('services.sessions.handlers')) | |
219 | handlers.extend(load_handlers('services.nbconvert.handlers')) |
|
223 | handlers.extend(load_handlers('services.nbconvert.handlers')) | |
220 | handlers.extend(load_handlers('services.kernelspecs.handlers')) |
|
224 | handlers.extend(load_handlers('services.kernelspecs.handlers')) | |
|
225 | ||||
221 | handlers.append( |
|
226 | handlers.append( | |
222 |
(r"/nbextensions/(.*)", FileFindHandler, { |
|
227 | (r"/nbextensions/(.*)", FileFindHandler, { | |
|
228 | 'path': settings['nbextensions_path'], | |||
|
229 | 'no_cache_paths': ['/'], # don't cache anything in nbextensions | |||
|
230 | }), | |||
223 | ) |
|
231 | ) | |
224 | # register base handlers last |
|
232 | # register base handlers last | |
225 | handlers.extend(load_handlers('base.handlers')) |
|
233 | handlers.extend(load_handlers('base.handlers')) |
General Comments 0
You need to be logged in to leave comments.
Login now