notebooks should always have one checkpoint

closes #4396
This commit is contained in:
MinRK 2013-10-23 10:37:49 -07:00
parent 3a4d719033
commit 6bc2c65c83
2 changed files with 5 additions and 1 deletions

View File

@ -222,6 +222,10 @@ class FileNotebookManager(NotebookManager):
if 'content' not in model:
raise web.HTTPError(400, u'No notebook JSON data provided')
# One checkpoint should always exist
if self.notebook_exists(name, path) and not self.list_checkpoints(name, path):
self.create_checkpoint(name, path)
new_path = model.get('path', path).strip('/')
new_name = model.get('name', name)

View File

@ -117,7 +117,7 @@ class NotebookManager(LoggingConfigurable):
raise NotImplementedError('must be implemented in a subclass')
def create_notebook_model(self, model=None, path=''):
"""Create a new untitled notebook and return its model with no content."""
"""Create a new notebook and return its model with no content."""
path = path.strip('/')
if model is None:
model = {}