##// END OF EJS Templates
Notebook id removed from the notebook format.
Brian E. Granger -
Show More
@@ -745,7 +745,6 b' var IPython = (function (IPython) {'
745 var data = this.toJSON();
745 var data = this.toJSON();
746 data.name = nbname;
746 data.name = nbname;
747 data.nbformat = 2;
747 data.nbformat = 2;
748 data.id = notebook_id
749 // We do the call with settings so we can set cache to false.
748 // We do the call with settings so we can set cache to false.
750 var settings = {
749 var settings = {
751 processData : false,
750 processData : false,
@@ -107,17 +107,13 b' def new_worksheet(name=None, cells=None):'
107 return ws
107 return ws
108
108
109
109
110 def new_notebook(name=None, id=None, worksheets=None, author=None, email=None,
110 def new_notebook(name=None, worksheets=None, author=None, email=None,
111 created=None, saved=None, license=None):
111 created=None, saved=None, license=None):
112 """Create a notebook by name, id and a list of worksheets."""
112 """Create a notebook by name, id and a list of worksheets."""
113 nb = NotebookNode()
113 nb = NotebookNode()
114 nb.nbformat = 2
114 nb.nbformat = 2
115 if name is not None:
115 if name is not None:
116 nb.name = unicode(name)
116 nb.name = unicode(name)
117 if id is None:
118 nb.id = unicode(uuid.uuid4())
119 else:
120 nb.id = unicode(id)
121 if worksheets is None:
117 if worksheets is None:
122 nb.worksheets = []
118 nb.worksheets = []
123 else:
119 else:
@@ -91,7 +91,6 b' class XMLReader(NotebookReader):'
91
91
92 def to_notebook(self, root, **kwargs):
92 def to_notebook(self, root, **kwargs):
93 nbname = _get_text(root,u'name')
93 nbname = _get_text(root,u'name')
94 nbid = _get_text(root,u'id')
95 nbauthor = _get_text(root,u'author')
94 nbauthor = _get_text(root,u'author')
96 nbemail = _get_text(root,u'email')
95 nbemail = _get_text(root,u'email')
97 nblicense = _get_text(root,u'license')
96 nblicense = _get_text(root,u'license')
@@ -152,7 +151,7 b' class XMLReader(NotebookReader):'
152 ws = new_worksheet(name=wsname,cells=cells)
151 ws = new_worksheet(name=wsname,cells=cells)
153 worksheets.append(ws)
152 worksheets.append(ws)
154
153
155 nb = new_notebook(name=nbname,id=nbid,worksheets=worksheets,author=nbauthor,
154 nb = new_notebook(name=nbname,worksheets=worksheets,author=nbauthor,
156 email=nbemail,license=nblicense,saved=nbsaved,created=nbcreated)
155 email=nbemail,license=nblicense,saved=nbsaved,created=nbcreated)
157 return nb
156 return nb
158
157
@@ -162,7 +161,6 b' class XMLWriter(NotebookWriter):'
162 def writes(self, nb, **kwargs):
161 def writes(self, nb, **kwargs):
163 nb_e = ET.Element(u'notebook')
162 nb_e = ET.Element(u'notebook')
164 _set_text(nb,u'name',nb_e,u'name')
163 _set_text(nb,u'name',nb_e,u'name')
165 _set_text(nb,u'id',nb_e,u'id')
166 _set_text(nb,u'author',nb_e,u'author')
164 _set_text(nb,u'author',nb_e,u'author')
167 _set_text(nb,u'email',nb_e,u'email')
165 _set_text(nb,u'email',nb_e,u'email')
168 _set_text(nb,u'license',nb_e,u'license')
166 _set_text(nb,u'license',nb_e,u'license')
@@ -76,7 +76,6 b' class TestNotebook(TestCase):'
76
76
77 def test_empty_notebook(self):
77 def test_empty_notebook(self):
78 nb = new_notebook()
78 nb = new_notebook()
79 self.assertEquals('id' in nb, True)
80 self.assertEquals(nb.worksheets, [])
79 self.assertEquals(nb.worksheets, [])
81 self.assertEquals('name' not in nb, True)
80 self.assertEquals('name' not in nb, True)
82 self.assertEquals(nb.nbformat,2)
81 self.assertEquals(nb.nbformat,2)
General Comments 0
You need to be logged in to leave comments. Login now