mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-11 03:52:59 +00:00
Edit spacing in singleuser.py
This commit is contained in:
@@ -39,16 +39,20 @@ from jupyterhub import __version__
|
|||||||
from .services.auth import HubAuth, HubAuthenticated
|
from .services.auth import HubAuth, HubAuthenticated
|
||||||
from .utils import url_path_join
|
from .utils import url_path_join
|
||||||
|
|
||||||
|
|
||||||
# Authenticate requests with the Hub
|
# Authenticate requests with the Hub
|
||||||
|
|
||||||
|
|
||||||
class HubAuthenticatedHandler(HubAuthenticated):
|
class HubAuthenticatedHandler(HubAuthenticated):
|
||||||
"""Class we are going to patch-in for authentication with the Hub"""
|
"""Class we are going to patch-in for authentication with the Hub"""
|
||||||
@property
|
@property
|
||||||
def hub_auth(self):
|
def hub_auth(self):
|
||||||
return self.settings['hub_auth']
|
return self.settings['hub_auth']
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hub_users(self):
|
def hub_users(self):
|
||||||
return { self.settings['user'] }
|
return { self.settings['user'] }
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hub_groups(self):
|
def hub_groups(self):
|
||||||
if self.settings['group']:
|
if self.settings['group']:
|
||||||
@@ -90,7 +94,7 @@ class JupyterHubLogoutHandler(LogoutHandler):
|
|||||||
# register new hub related command-line aliases
|
# register new hub related command-line aliases
|
||||||
aliases = dict(notebook_aliases)
|
aliases = dict(notebook_aliases)
|
||||||
aliases.update({
|
aliases.update({
|
||||||
'user' : 'SingleUserNotebookApp.user',
|
'user': 'SingleUserNotebookApp.user',
|
||||||
'group': 'SingleUserNotebookApp.group',
|
'group': 'SingleUserNotebookApp.group',
|
||||||
'cookie-name': 'HubAuth.cookie_name',
|
'cookie-name': 'HubAuth.cookie_name',
|
||||||
'hub-prefix': 'SingleUserNotebookApp.hub_prefix',
|
'hub-prefix': 'SingleUserNotebookApp.hub_prefix',
|
||||||
@@ -124,6 +128,7 @@ Control Panel</a>
|
|||||||
{% endblock logo %}
|
{% endblock logo %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def _exclude_home(path_list):
|
def _exclude_home(path_list):
|
||||||
"""Filter out any entries in a path list that are in my home directory.
|
"""Filter out any entries in a path list that are in my home directory.
|
||||||
|
|
||||||
@@ -150,6 +155,7 @@ class SingleUserNotebookApp(NotebookApp):
|
|||||||
|
|
||||||
user = CUnicode().tag(config=True)
|
user = CUnicode().tag(config=True)
|
||||||
group = CUnicode().tag(config=True)
|
group = CUnicode().tag(config=True)
|
||||||
|
|
||||||
@observe('user')
|
@observe('user')
|
||||||
def _user_changed(self, change):
|
def _user_changed(self, change):
|
||||||
self.log.name = change.new
|
self.log.name = change.new
|
||||||
@@ -157,12 +163,14 @@ class SingleUserNotebookApp(NotebookApp):
|
|||||||
hub_host = Unicode().tag(config=True)
|
hub_host = Unicode().tag(config=True)
|
||||||
|
|
||||||
hub_prefix = Unicode('/hub/').tag(config=True)
|
hub_prefix = Unicode('/hub/').tag(config=True)
|
||||||
|
|
||||||
@default('hub_prefix')
|
@default('hub_prefix')
|
||||||
def _hub_prefix_default(self):
|
def _hub_prefix_default(self):
|
||||||
base_url = os.environ.get('JUPYTERHUB_BASE_URL') or '/'
|
base_url = os.environ.get('JUPYTERHUB_BASE_URL') or '/'
|
||||||
return base_url + 'hub/'
|
return base_url + 'hub/'
|
||||||
|
|
||||||
hub_api_url = Unicode().tag(config=True)
|
hub_api_url = Unicode().tag(config=True)
|
||||||
|
|
||||||
@default('hub_api_url')
|
@default('hub_api_url')
|
||||||
def _hub_api_url_default(self):
|
def _hub_api_url_default(self):
|
||||||
return os.environ.get('JUPYTERHUB_API_URL') or 'http://127.0.0.1:8081/hub/api'
|
return os.environ.get('JUPYTERHUB_API_URL') or 'http://127.0.0.1:8081/hub/api'
|
||||||
@@ -199,7 +207,7 @@ class SingleUserNotebookApp(NotebookApp):
|
|||||||
trust_xheaders = True
|
trust_xheaders = True
|
||||||
login_handler_class = JupyterHubLoginHandler
|
login_handler_class = JupyterHubLoginHandler
|
||||||
logout_handler_class = JupyterHubLogoutHandler
|
logout_handler_class = JupyterHubLogoutHandler
|
||||||
port_retries = 0 # disable port-retries, since the Spawner will tell us what port to use
|
port_retries = 0 # disable port-retries, since the Spawner will tell us what port to use
|
||||||
|
|
||||||
disable_user_config = Bool(False,
|
disable_user_config = Bool(False,
|
||||||
help="""Disable user configuration of single-user server.
|
help="""Disable user configuration of single-user server.
|
||||||
|
Reference in New Issue
Block a user