From 5825b966f2f8c6305b780ee3d8399c17c4f94904 2013-10-17 21:07:51 From: Zachary Sailer Date: 2013-10-17 21:07:51 Subject: [PATCH] Download '.py' fixed, deleted debugging output --- diff --git a/IPython/html/notebook/handlers.py b/IPython/html/notebook/handlers.py index 4257cd9..3a7048e 100644 --- a/IPython/html/notebook/handlers.py +++ b/IPython/html/notebook/handlers.py @@ -22,7 +22,6 @@ HTTPError = web.HTTPError from ..base.handlers import IPythonHandler from ..utils import url_path_join -from urllib import quote #----------------------------------------------------------------------------- # Handlers @@ -51,9 +50,6 @@ class NamedNotebookHandler(IPythonHandler): def get(self, notebook_path): nbm = self.notebook_manager name, path = nbm.named_notebook_path(notebook_path) - if name != None: - name = quote(name) - self.log.info(name) if path == None: project = self.project + '/' + name else: diff --git a/IPython/html/services/notebooks/handlers.py b/IPython/html/services/notebooks/handlers.py index 8ab6a2c..f5d659b 100644 --- a/IPython/html/services/notebooks/handlers.py +++ b/IPython/html/services/notebooks/handlers.py @@ -70,7 +70,7 @@ class NotebookHandler(IPythonHandler): else: format = self.get_argument('format', default='json') model = nbm.notebook_model(name,path) - data, name = nbm.get_notebook(model, format) + last_mod, representation, name = nbm.get_notebook(name, path, format) if format == u'json': self.set_header('Content-Type', 'application/json') diff --git a/IPython/html/services/notebooks/nbmanager.py b/IPython/html/services/notebooks/nbmanager.py index 4ba4b1a..51b7aa5 100644 --- a/IPython/html/services/notebooks/nbmanager.py +++ b/IPython/html/services/notebooks/nbmanager.py @@ -117,19 +117,20 @@ class NotebookManager(LoggingConfigurable): "content": content} return model - def get_notebook(self, body, format=u'json'): + def get_notebook(self, notebook_name, notebook_path=None, format=u'json'): """Get the representation of a notebook in format by notebook_name.""" format = unicode(format) if format not in self.allowed_formats: raise web.HTTPError(415, u'Invalid notebook format: %s' % format) kwargs = {} + last_mod, nb = self.read_notebook_object(notebook_name, notebook_path) if format == 'json': # don't split lines for sending over the wire, because it # should match the Python in-memory format. kwargs['split_lines'] = False - representation = current.writes(body, format, **kwargs) - name = body['content']['metadata']['name'] - return representation, name + representation = current.writes(nb, format, **kwargs) + name = nb.metadata.get('name', 'notebook') + return last_mod, representation, name def read_notebook_object(self, notebook_name, notebook_path): """Get the object representation of a notebook by notebook_id."""