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