From cbc141c95c38798e9d8d71ea4068c3b2b4df84ef Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Thu, 10 Oct 2013 15:02:35 -0700 Subject: [PATCH] Fixes for notebook checkpoint APIs --- IPython/html/services/notebooks/filenbmanager.py | 2 +- IPython/html/services/notebooks/handlers.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/IPython/html/services/notebooks/filenbmanager.py b/IPython/html/services/notebooks/filenbmanager.py index 908ad96ea..9d0a73c5e 100644 --- a/IPython/html/services/notebooks/filenbmanager.py +++ b/IPython/html/services/notebooks/filenbmanager.py @@ -394,7 +394,7 @@ class FileNotebookManager(NotebookManager): u'Notebook checkpoint does not exist: %s-%s' % (name, checkpoint_id) ) # ensure notebook is readable (never restore from an unreadable notebook) - with file(cp_path, 'r') as f: + with open(cp_path, 'r') as f: nb = current.read(f, u'json') shutil.copy2(cp_path, nb_path) self.log.debug("copying %s -> %s", cp_path, nb_path) diff --git a/IPython/html/services/notebooks/handlers.py b/IPython/html/services/notebooks/handlers.py index 540a2337c..37f6f3aed 100644 --- a/IPython/html/services/notebooks/handlers.py +++ b/IPython/html/services/notebooks/handlers.py @@ -197,6 +197,7 @@ class NotebookCheckpointsHandler(IPythonHandler): location = url_path_join(self.base_project_url, u'/api/notebooks', path, name, 'checkpoints', checkpoint[u'checkpoint_id']) self.set_header(u'Location', location) + self.set_status(201) self.finish(data)