Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NotebookApp.terminals_enabled config option #3478

Merged
merged 1 commit into from
Apr 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,16 @@ def _update_server_extensions(self, change):
"0 (the default) disables this automatic shutdown.")
)

terminals_enabled = Bool(True, config=True,
help=_("""Set to False to disable terminals.

This does *not* make the notebook server more secure by itself.
Anything the user can in a terminal, they can also do in a notebook.

Terminals may also be automatically disabled if the terminado package
is not available.
"""))

def parse_command_line(self, argv=None):
super(NotebookApp, self).parse_command_line(argv)

Expand Down Expand Up @@ -1345,6 +1355,9 @@ def _url(self, ip):
return "%s://%s:%i%s" % (proto, ip, self.port, self.base_url)

def init_terminals(self):
if not self.terminals_enabled:
return

try:
from .terminal import initialize
initialize(self.web_app, self.notebook_dir, self.connection_url, self.terminado_settings)
Expand Down