From a86896dd610250f2a895b16848954089ec2f6a36 2011-08-15 05:38:46 From: Brian E. Granger Date: 2011-08-15 05:38:46 Subject: [PATCH] Notebook id removed from the notebook format. --- diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index ea5693b..4d84117 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -745,7 +745,6 @@ var IPython = (function (IPython) { var data = this.toJSON(); data.name = nbname; data.nbformat = 2; - data.id = notebook_id // We do the call with settings so we can set cache to false. var settings = { processData : false, diff --git a/IPython/nbformat/v2/nbbase.py b/IPython/nbformat/v2/nbbase.py index dcc430d..90d76b9 100644 --- a/IPython/nbformat/v2/nbbase.py +++ b/IPython/nbformat/v2/nbbase.py @@ -107,17 +107,13 @@ def new_worksheet(name=None, cells=None): return ws -def new_notebook(name=None, id=None, worksheets=None, author=None, email=None, +def new_notebook(name=None, worksheets=None, author=None, email=None, created=None, saved=None, license=None): """Create a notebook by name, id and a list of worksheets.""" nb = NotebookNode() nb.nbformat = 2 if name is not None: nb.name = unicode(name) - if id is None: - nb.id = unicode(uuid.uuid4()) - else: - nb.id = unicode(id) if worksheets is None: nb.worksheets = [] else: diff --git a/IPython/nbformat/v2/nbxml.py b/IPython/nbformat/v2/nbxml.py index b5f7e62..1952e4d 100644 --- a/IPython/nbformat/v2/nbxml.py +++ b/IPython/nbformat/v2/nbxml.py @@ -91,7 +91,6 @@ class XMLReader(NotebookReader): def to_notebook(self, root, **kwargs): nbname = _get_text(root,u'name') - nbid = _get_text(root,u'id') nbauthor = _get_text(root,u'author') nbemail = _get_text(root,u'email') nblicense = _get_text(root,u'license') @@ -152,7 +151,7 @@ class XMLReader(NotebookReader): ws = new_worksheet(name=wsname,cells=cells) worksheets.append(ws) - nb = new_notebook(name=nbname,id=nbid,worksheets=worksheets,author=nbauthor, + nb = new_notebook(name=nbname,worksheets=worksheets,author=nbauthor, email=nbemail,license=nblicense,saved=nbsaved,created=nbcreated) return nb @@ -162,7 +161,6 @@ class XMLWriter(NotebookWriter): def writes(self, nb, **kwargs): nb_e = ET.Element(u'notebook') _set_text(nb,u'name',nb_e,u'name') - _set_text(nb,u'id',nb_e,u'id') _set_text(nb,u'author',nb_e,u'author') _set_text(nb,u'email',nb_e,u'email') _set_text(nb,u'license',nb_e,u'license') diff --git a/IPython/nbformat/v2/tests/test_nbbase.py b/IPython/nbformat/v2/tests/test_nbbase.py index a263e6a..2f854d7 100644 --- a/IPython/nbformat/v2/tests/test_nbbase.py +++ b/IPython/nbformat/v2/tests/test_nbbase.py @@ -76,7 +76,6 @@ class TestNotebook(TestCase): def test_empty_notebook(self): nb = new_notebook() - self.assertEquals('id' in nb, True) self.assertEquals(nb.worksheets, []) self.assertEquals('name' not in nb, True) self.assertEquals(nb.nbformat,2)