Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cc431b

Browse files
committed
finish up FilesHandler
- load FilesHandler like everything else - remove copy/paste leftovers
1 parent 20844ef commit 7cc431b

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

IPython/html/files/handlers.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
"""Base Tornado handlers for the notebook server."""
1+
"""Serve files directly from the ContentsManager."""
22

33
# Copyright (c) IPython Development Team.
44
# Distributed under the terms of the Modified BSD License.
55

6-
import logging
76
import os
87
import mimetypes
98
import json
109
import base64
1110

1211
from tornado import web
1312

14-
try:
15-
from tornado.log import app_log
16-
except ImportError:
17-
app_log = logging.getLogger()
18-
1913
from IPython.html.base.handlers import IPythonHandler
2014

2115
class FilesHandler(IPythonHandler):
@@ -49,3 +43,6 @@ def get(self, path):
4943
self.write(model['content'])
5044
self.flush()
5145

46+
default_handlers = [
47+
(r"/files/(.*)", FilesHandler),
48+
]

IPython/html/notebookapp.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
from zmq.eventloop import ioloop
3535
ioloop.install()
3636

37-
from IPython.html.files.handlers import FilesHandler
38-
3937
# check for tornado 3.1.0
4038
msg = "The IPython Notebook requires tornado >= 3.1.0"
4139
try:
@@ -188,6 +186,7 @@ def init_handlers(self, settings):
188186
handlers.extend(load_handlers('tree.handlers'))
189187
handlers.extend(load_handlers('auth.login'))
190188
handlers.extend(load_handlers('auth.logout'))
189+
handlers.extend(load_handlers('files.handlers'))
191190
handlers.extend(load_handlers('notebook.handlers'))
192191
handlers.extend(load_handlers('nbconvert.handlers'))
193192
handlers.extend(load_handlers('kernelspecs.handlers'))
@@ -197,9 +196,6 @@ def init_handlers(self, settings):
197196
handlers.extend(load_handlers('services.sessions.handlers'))
198197
handlers.extend(load_handlers('services.nbconvert.handlers'))
199198
handlers.extend(load_handlers('services.kernelspecs.handlers'))
200-
handlers.append(
201-
(r"/files/(.*)", FilesHandler),
202-
)
203199
handlers.append(
204200
(r"/nbextensions/(.*)", FileFindHandler, {'path' : settings['nbextensions_path']}),
205201
)

0 commit comments

Comments
 (0)