mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-19 13:20:36 +08:00
finish up FilesHandler
- load FilesHandler like everything else - remove copy/paste leftovers
This commit is contained in:
parent
a490488f62
commit
868994087f
@ -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),
|
||||
]
|
@ -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']}),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user