##// END OF EJS Templates
use NotebookManager APIs in nbconvert handler
MinRK -
Show More
@@ -76,15 +76,12 b' class NbconvertFileHandler(IPythonHandler):'
76 exporter = get_exporter(format, config=self.config)
76 exporter = get_exporter(format, config=self.config)
77
77
78 path = path.strip('/')
78 path = path.strip('/')
79 os_path = self.notebook_manager.get_os_path(name, path)
79 model = self.notebook_manager.get_notebook(name=name, path=path)
80 if not os.path.isfile(os_path):
81 raise web.HTTPError(404, u'Notebook does not exist: %s' % name)
82
80
83 info = os.stat(os_path)
81 self.set_header('Last-Modified', model['last_modified'])
84 self.set_header('Last-Modified', tz.utcfromtimestamp(info.st_mtime))
85
82
86 try:
83 try:
87 output, resources = exporter.from_filename(os_path)
84 output, resources = exporter.from_notebook_node(model['content'])
88 except Exception as e:
85 except Exception as e:
89 raise web.HTTPError(500, "nbconvert failed: %s" % e)
86 raise web.HTTPError(500, "nbconvert failed: %s" % e)
90
87
General Comments 0
You need to be logged in to leave comments. Login now