From 5714cabb269975a88638fc51bb517b5e43d71980 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 23 Jul 2015 10:12:49 -0700 Subject: [PATCH] fix files redirect in nbconvert handlers the way it was set up prevented the redirect handler from ever being called --- notebook/nbconvert/handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebook/nbconvert/handlers.py b/notebook/nbconvert/handlers.py index 1dc25592b..43fe5c9ca 100644 --- a/notebook/nbconvert/handlers.py +++ b/notebook/nbconvert/handlers.py @@ -85,7 +85,8 @@ class NbconvertFileHandler(IPythonHandler): model = self.contents_manager.get(path=path) name = model['name'] if model['type'] != 'notebook': - raise web.HTTPError(400, "Not a notebook: %s" % path) + # not a notebook, redirect to files + return FilesRedirectHandler.redirect_to_files(self, path) self.set_header('Last-Modified', model['last_modified']) @@ -157,5 +158,4 @@ default_handlers = [ (r"/nbconvert/%s" % _format_regex, NbconvertPostHandler), (r"/nbconvert/%s%s" % (_format_regex, path_regex), NbconvertFileHandler), - (r"/nbconvert/html%s" % path_regex, FilesRedirectHandler), ]