From 868994087f5c95b057965aede9a8ed649a32bb3b Mon Sep 17 00:00:00 2001 From: MinRK Date: Thu, 16 Oct 2014 09:26:27 -0700 Subject: [PATCH] finish up FilesHandler - load FilesHandler like everything else - remove copy/paste leftovers --- IPython/html/files/handlers.py | 11 ++++------- IPython/html/notebookapp.py | 6 +----- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/IPython/html/files/handlers.py b/IPython/html/files/handlers.py index 1301b8e5a..f1f38b176 100644 --- a/IPython/html/files/handlers.py +++ b/IPython/html/files/handlers.py @@ -1,9 +1,8 @@ -"""Base Tornado handlers for the notebook server.""" +"""Serve files directly from the ContentsManager.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. -import logging import os import mimetypes import json @@ -11,11 +10,6 @@ import base64 from tornado import web -try: - from tornado.log import app_log -except ImportError: - app_log = logging.getLogger() - from IPython.html.base.handlers import IPythonHandler class FilesHandler(IPythonHandler): @@ -49,3 +43,6 @@ class FilesHandler(IPythonHandler): self.write(model['content']) self.flush() +default_handlers = [ + (r"/files/(.*)", FilesHandler), +] \ No newline at end of file diff --git a/IPython/html/notebookapp.py b/IPython/html/notebookapp.py index 98d7364ea..e8e920f34 100644 --- a/IPython/html/notebookapp.py +++ b/IPython/html/notebookapp.py @@ -34,8 +34,6 @@ from jinja2 import Environment, FileSystemLoader from zmq.eventloop import ioloop ioloop.install() -from IPython.html.files.handlers import FilesHandler - # check for tornado 3.1.0 msg = "The IPython Notebook requires tornado >= 3.1.0" try: @@ -188,6 +186,7 @@ class NotebookWebApplication(web.Application): handlers.extend(load_handlers('tree.handlers')) handlers.extend(load_handlers('auth.login')) handlers.extend(load_handlers('auth.logout')) + handlers.extend(load_handlers('files.handlers')) handlers.extend(load_handlers('notebook.handlers')) handlers.extend(load_handlers('nbconvert.handlers')) handlers.extend(load_handlers('kernelspecs.handlers')) @@ -197,9 +196,6 @@ class NotebookWebApplication(web.Application): handlers.extend(load_handlers('services.sessions.handlers')) handlers.extend(load_handlers('services.nbconvert.handlers')) handlers.extend(load_handlers('services.kernelspecs.handlers')) - handlers.append( - (r"/files/(.*)", FilesHandler), - ) handlers.append( (r"/nbextensions/(.*)", FileFindHandler, {'path' : settings['nbextensions_path']}), )