Show More
@@ -223,6 +223,10 b' class FileNotebookManager(NotebookManager):' | |||||
223 | if 'content' not in model: |
|
223 | if 'content' not in model: | |
224 | raise web.HTTPError(400, u'No notebook JSON data provided') |
|
224 | raise web.HTTPError(400, u'No notebook JSON data provided') | |
225 |
|
225 | |||
|
226 | # One checkpoint should always exist | |||
|
227 | if self.notebook_exists(name, path) and not self.list_checkpoints(name, path): | |||
|
228 | self.create_checkpoint(name, path) | |||
|
229 | ||||
226 | new_path = model.get('path', path).strip('/') |
|
230 | new_path = model.get('path', path).strip('/') | |
227 | new_name = model.get('name', name) |
|
231 | new_name = model.get('name', name) | |
228 |
|
232 | |||
@@ -326,8 +330,9 b' class FileNotebookManager(NotebookManager):' | |||||
326 | def get_checkpoint_path(self, checkpoint_id, name, path=''): |
|
330 | def get_checkpoint_path(self, checkpoint_id, name, path=''): | |
327 | """find the path to a checkpoint""" |
|
331 | """find the path to a checkpoint""" | |
328 | path = path.strip('/') |
|
332 | path = path.strip('/') | |
|
333 | basename, _ = os.path.splitext(name) | |||
329 | filename = u"{name}-{checkpoint_id}{ext}".format( |
|
334 | filename = u"{name}-{checkpoint_id}{ext}".format( | |
330 | name=name, |
|
335 | name=basename, | |
331 | checkpoint_id=checkpoint_id, |
|
336 | checkpoint_id=checkpoint_id, | |
332 | ext=self.filename_ext, |
|
337 | ext=self.filename_ext, | |
333 | ) |
|
338 | ) |
@@ -117,7 +117,7 b' class NotebookManager(LoggingConfigurable):' | |||||
117 | raise NotImplementedError('must be implemented in a subclass') |
|
117 | raise NotImplementedError('must be implemented in a subclass') | |
118 |
|
118 | |||
119 | def create_notebook_model(self, model=None, path=''): |
|
119 | def create_notebook_model(self, model=None, path=''): | |
120 |
"""Create a new |
|
120 | """Create a new notebook and return its model with no content.""" | |
121 | path = path.strip('/') |
|
121 | path = path.strip('/') | |
122 | if model is None: |
|
122 | if model is None: | |
123 | model = {} |
|
123 | model = {} |
General Comments 0
You need to be logged in to leave comments.
Login now