Adding prototype nbextensions argument to NotebookApp

This commit is contained in:
Brian E. Granger 2015-12-16 22:32:05 -08:00 committed by Jonathan Frederic
parent d6b4ef071b
commit 142ae515bc
4 changed files with 13 additions and 1 deletions

View File

@ -292,6 +292,10 @@ class IPythonHandler(AuthenticatedHandler):
# template rendering
#---------------------------------------------------------------
@property
def nbextensions(self):
return self.settings.get('nbextensions', [])
def get_template(self, name):
"""Return the jinja template object for a given name"""
return self.settings['jinja2_env'].get_template(name)

View File

@ -4,6 +4,7 @@
# Distributed under the terms of the Modified BSD License.
import os
import json
from tornado import web
HTTPError = web.HTTPError
@ -21,6 +22,7 @@ class NotebookHandler(IPythonHandler):
redirects to the '/files/' handler if the name is not given."""
path = path.strip('/')
cm = self.contents_manager
nbextensions = json.dumps(self.nbextensions)
# will raise 404 on not found
try:
@ -40,6 +42,7 @@ class NotebookHandler(IPythonHandler):
notebook_name=name,
kill_kernel=False,
mathjax_url=self.mathjax_url,
nbextensions=nbextensions
)
)

View File

@ -219,6 +219,8 @@ class NotebookWebApplication(web.Application):
iopub_data_rate_limit=ipython_app.iopub_data_rate_limit,
rate_limit_window=ipython_app.rate_limit_window,
nbextensions=ipython_app.nbextensions,
# authentication
cookie_secret=ipython_app.cookie_secret,
login_url=url_path_join(base_url,'/login'),
@ -691,6 +693,9 @@ class NotebookApp(JupyterApp):
path.append(os.path.join(get_ipython_dir(), 'nbextensions'))
return path
nbextensions = List(Unicode(), config=True,
help="A list of nbextensions to enable.")
websocket_url = Unicode("", config=True,
help="""The base URL for websockets,
if it differs from the HTTP server (hint: it almost certainly doesn't).

View File

@ -30,7 +30,7 @@ data-base-url="{{base_url | urlencode}}"
data-ws-url="{{ws_url | urlencode}}"
data-notebook-name="{{notebook_name | urlencode}}"
data-notebook-path="{{notebook_path | urlencode}}"
data-nbextensions="{{nbextensions}}"
{% endblock %}