##// END OF EJS Templates
When a notebook is written to file, name the metadata name u''.
Brian E. Granger -
Show More
@@ -156,6 +156,10 b' class FileNotebookManager(NotebookManager):'
156 raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
156 raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
157 last_modified, nb = self.read_notebook_object_from_path(path)
157 last_modified, nb = self.read_notebook_object_from_path(path)
158 # Always use the filename as the notebook name.
158 # Always use the filename as the notebook name.
159 # Eventually we will get rid of the notebook name in the metadata
160 # but for now, that name is just an empty string. Until the notebooks
161 # web service knows about names in URLs we still pass the name
162 # back to the web app using the metadata though.
159 nb.metadata.name = os.path.splitext(os.path.basename(path))[0]
163 nb.metadata.name = os.path.splitext(os.path.basename(path))[0]
160 return last_modified, nb
164 return last_modified, nb
161
165
@@ -173,9 +177,15 b' class FileNotebookManager(NotebookManager):'
173 raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
177 raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
174
178
175 old_name = self.mapping[notebook_id]
179 old_name = self.mapping[notebook_id]
176 old_checkpoints = self.list_checkpoints(notebook_id)
180 old_checkpoints = self.list_checkpoints(notebook_id)
177
178 path = self.get_path_by_name(new_name)
181 path = self.get_path_by_name(new_name)
182
183 # Right before we save the notebook, we write an empty string as the
184 # notebook name in the metadata. This is to prepare for removing
185 # this attribute entirely post 1.0. The web app still uses the metadata
186 # name for now.
187 nb.metadata.name = u''
188
179 try:
189 try:
180 self.log.debug("Autosaving notebook %s", path)
190 self.log.debug("Autosaving notebook %s", path)
181 with open(path,'w') as f:
191 with open(path,'w') as f:
General Comments 0
You need to be logged in to leave comments. Login now