##// END OF EJS Templates
use 'id' for checkpoint ID key...
MinRK -
Show More
@@ -278,7 +278,7 b' class FileNotebookManager(NotebookManager):'
278 278
279 279 # clear checkpoints
280 280 for checkpoint in self.list_checkpoints(name, path):
281 checkpoint_id = checkpoint['checkpoint_id']
281 checkpoint_id = checkpoint['id']
282 282 cp_path = self.get_checkpoint_path(checkpoint_id, name, path)
283 283 if os.path.isfile(cp_path):
284 284 self.log.debug("Unlinking checkpoint %s", cp_path)
@@ -315,7 +315,7 b' class FileNotebookManager(NotebookManager):'
315 315 # Move the checkpoints
316 316 old_checkpoints = self.list_checkpoints(old_name, old_path)
317 317 for cp in old_checkpoints:
318 checkpoint_id = cp['checkpoint_id']
318 checkpoint_id = cp['id']
319 319 old_cp_path = self.get_checkpoint_path(checkpoint_id, old_name, old_path)
320 320 new_cp_path = self.get_checkpoint_path(checkpoint_id, new_name, new_path)
321 321 if os.path.isfile(old_cp_path):
@@ -346,7 +346,7 b' class FileNotebookManager(NotebookManager):'
346 346 stats = os.stat(cp_path)
347 347 last_modified = tz.utcfromtimestamp(stats.st_mtime)
348 348 info = dict(
349 checkpoint_id = checkpoint_id,
349 id = checkpoint_id,
350 350 last_modified = last_modified,
351 351 )
352 352 return info
@@ -180,9 +180,9 b' class NotebookCheckpointsHandler(IPythonHandler):'
180 180 nbm = self.notebook_manager
181 181 checkpoint = nbm.create_checkpoint(name, path)
182 182 data = json.dumps(checkpoint, default=date_default)
183 location = url_path_join(self.base_project_url, u'/api/notebooks',
184 path, name, 'checkpoints', checkpoint[u'checkpoint_id'])
185 self.set_header(u'Location', location)
183 location = url_path_join(self.base_project_url, 'api/notebooks',
184 path, name, 'checkpoints', checkpoint['id'])
185 self.set_header('Location', location)
186 186 self.set_status(201)
187 187 self.finish(data)
188 188
@@ -229,8 +229,8 b' class APITest(NotebookTestBase):'
229 229 r = self.nb_api.new_checkpoint('a.ipynb', 'foo')
230 230 self.assertEqual(r.status_code, 201)
231 231 cp1 = r.json()
232 self.assertEqual(set(cp1), {'checkpoint_id', 'last_modified'})
233 self.assertEqual(r.headers['Location'].split('/')[-1], cp1['checkpoint_id'])
232 self.assertEqual(set(cp1), {'id', 'last_modified'})
233 self.assertEqual(r.headers['Location'].split('/')[-1], cp1['id'])
234 234
235 235 # Modify it
236 236 nbcontent = jsonapi.loads(resp.text)['content']
@@ -252,14 +252,14 b' class APITest(NotebookTestBase):'
252 252 self.assertEqual(nb.worksheets[0].cells[0].source, 'Created by test')
253 253
254 254 # Restore cp1
255 r = self.nb_api.restore_checkpoint('a.ipynb', 'foo', cp1['checkpoint_id'])
255 r = self.nb_api.restore_checkpoint('a.ipynb', 'foo', cp1['id'])
256 256 self.assertEqual(r.status_code, 204)
257 257 nbcontent = self.nb_api.read('a.ipynb', 'foo').json()['content']
258 258 nb = to_notebook_json(nbcontent)
259 259 self.assertEqual(nb.worksheets, [])
260 260
261 261 # Delete cp1
262 r = self.nb_api.delete_checkpoint('a.ipynb', 'foo', cp1['checkpoint_id'])
262 r = self.nb_api.delete_checkpoint('a.ipynb', 'foo', cp1['id'])
263 263 self.assertEqual(r.status_code, 204)
264 264 cps = self.nb_api.get_checkpoints('a.ipynb', 'foo').json()
265 265 self.assertEqual(cps, [])
@@ -2009,7 +2009,7 b' var IPython = (function (IPython) {'
2009 2009 var found = false;
2010 2010 for (var i = 0; i < this.checkpoints.length; i++) {
2011 2011 var existing = this.checkpoints[i];
2012 if (existing.checkpoint_id == checkpoint.checkpoint_id) {
2012 if (existing.id == checkpoint.id) {
2013 2013 found = true;
2014 2014 this.checkpoints[i] = checkpoint;
2015 2015 break;
@@ -2149,7 +2149,7 b' var IPython = (function (IPython) {'
2149 2149 Revert : {
2150 2150 class : "btn-danger",
2151 2151 click : function () {
2152 that.restore_checkpoint(checkpoint.checkpoint_id);
2152 that.restore_checkpoint(checkpoint.id);
2153 2153 }
2154 2154 },
2155 2155 Cancel : {}
General Comments 0
You need to be logged in to leave comments. Login now