diff --git a/IPython/html/notebook/handlers.py b/IPython/html/notebook/handlers.py
index be27df50e..c3a8cfd15 100644
--- a/IPython/html/notebook/handlers.py
+++ b/IPython/html/notebook/handlers.py
@@ -67,6 +67,11 @@ class NamedNotebookHandler(IPythonHandler):
mathjax_url=self.mathjax_url,
)
)
+
+ @web.authenticated
+ def post(self, notebook_path):
+ nbm =self.notebook_manager
+ notebook_name = nbm.new_notebook()
class NotebookCopyHandler(IPythonHandler):
diff --git a/IPython/html/services/contents/handlers.py b/IPython/html/services/contents/handlers.py
index 321477357..c3084ee3e 100644
--- a/IPython/html/services/contents/handlers.py
+++ b/IPython/html/services/contents/handlers.py
@@ -6,7 +6,7 @@ Authors:
"""
#-----------------------------------------------------------------------------
-# Copyright (C) 2008-2011 The IPython Development Team
+# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
diff --git a/IPython/html/services/notebooks/filenbmanager.py b/IPython/html/services/notebooks/filenbmanager.py
index a38eb0bbc..f9140c7e2 100644
--- a/IPython/html/services/notebooks/filenbmanager.py
+++ b/IPython/html/services/notebooks/filenbmanager.py
@@ -89,7 +89,7 @@ class FileNotebookManager(NotebookManager):
notebook_names = self.get_notebook_names(path)
notebook_mapping = []
for name in notebook_names:
- model = self.notebook_model(name, path)
+ model = self.notebook_model(name, path, content=False)
notebook_mapping.append(model)
return notebook_mapping
diff --git a/IPython/html/services/notebooks/nbmanager.py b/IPython/html/services/notebooks/nbmanager.py
index 42300e1d8..d51e8659a 100644
--- a/IPython/html/services/notebooks/nbmanager.py
+++ b/IPython/html/services/notebooks/nbmanager.py
@@ -114,13 +114,15 @@ class NotebookManager(LoggingConfigurable):
def notebook_exists(self, notebook_path):
"""Does a notebook exist?"""
- def notebook_model(self, notebook_name, notebook_path=None):
+
+ def notebook_model(self, notebook_name, notebook_path=None, content=True):
""" Creates the standard notebook model """
- last_modified, content = self.read_notebook_object(notebook_name, notebook_path)
+ last_modified, contents = self.read_notebook_object(notebook_name, notebook_path)
model = {"notebook_name": notebook_name,
"notebook_path": notebook_path,
- "content": content,
"last_modified": last_modified.ctime()}
+ if content == True:
+ model['content'] = contents
return model
def get_notebook(self, notebook_name, notebook_path=None, format=u'json'):
@@ -143,7 +145,7 @@ class NotebookManager(LoggingConfigurable):
raise NotImplementedError('must be implemented in a subclass')
def save_new_notebook(self, data, notebook_path = None, name=None, format=u'json'):
- """Save a new notebook and return its notebook_id.
+ """Save a new notebook and return its name.
If a name is passed in, it overrides any values in the notebook data
and the value in the data is updated to use that value.
diff --git a/IPython/html/services/sessions/handlers.py b/IPython/html/services/sessions/handlers.py
index 60dfdbebe..2cc41793c 100644
--- a/IPython/html/services/sessions/handlers.py
+++ b/IPython/html/services/sessions/handlers.py
@@ -1,4 +1,4 @@
-"""Tornado handlers for the notebooks web service.
+"""Tornado handlers for the sessions web service.
Authors:
@@ -6,7 +6,7 @@ Authors:
"""
#-----------------------------------------------------------------------------
-# Copyright (C) 2008-2011 The IPython Development Team
+# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
diff --git a/IPython/html/services/sessions/sessionmanager.py b/IPython/html/services/sessions/sessionmanager.py
index 358f7b13f..0f5579321 100644
--- a/IPython/html/services/sessions/sessionmanager.py
+++ b/IPython/html/services/sessions/sessionmanager.py
@@ -6,7 +6,7 @@ Authors:
"""
#-----------------------------------------------------------------------------
-# Copyright (C) 2011 The IPython Development Team
+# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
@@ -53,6 +53,8 @@ class SessionManager(LoggingConfigurable):
notebook_name=notebook_name,
notebook_path=notebook_path,
kernel=kernel)
+ if notebook_path == None:
+ model['notebook_path']=""
self.sessions.append(model)
return model