##// END OF EJS Templates
fixes #7360 by setting resources.metadata
Nicholas Bollweg -
Show More
@@ -6,6 +6,7 b''
6 6 import io
7 7 import os
8 8 import zipfile
9 import collections
9 10
10 11 from tornado import web
11 12
@@ -16,6 +17,7 b' from ..base.handlers import ('
16 17 from IPython.nbformat import from_dict
17 18
18 19 from IPython.utils.py3compat import cast_bytes
20 from IPython.utils import text
19 21
20 22 def find_resource_files(output_files_dir):
21 23 files = []
@@ -89,7 +91,16 b' class NbconvertFileHandler(IPythonHandler):'
89 91 self.set_header('Last-Modified', model['last_modified'])
90 92
91 93 try:
92 output, resources = exporter.from_notebook_node(model['content'])
94 output, resources = exporter.from_notebook_node(
95 model['content'],
96 resources={
97 "metadata": {
98 "name": name[:name.rfind('.')],
99 "modified_date": (model['last_modified']
100 .strftime(text.date_format))
101 }
102 }
103 )
93 104 except Exception as e:
94 105 raise web.HTTPError(500, "nbconvert failed: %s" % e)
95 106
@@ -241,7 +241,9 b' class Exporter(LoggingConfigurable):'
241 241 #Make sure the metadata extension exists in resources
242 242 if 'metadata' in resources:
243 243 if not isinstance(resources['metadata'], ResourcesDict):
244 resources['metadata'] = ResourcesDict(resources['metadata'])
244 new_metadata = ResourcesDict()
245 new_metadata.update(resources['metadata'])
246 resources['metadata'] = new_metadata
245 247 else:
246 248 resources['metadata'] = ResourcesDict()
247 249 if not resources['metadata']['name']:
General Comments 0
You need to be logged in to leave comments. Login now