Skip to content

Commit 155c8f6

Browse files
committed
singleuser: add some clarifying comments
1 parent 969084d commit 155c8f6

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
share/jupyterhub/templates/
22
share/jupyterhub/static/js/admin-react.js
3+
jupyterhub/singleuser/templates/

jupyterhub/singleuser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .mixins import HubAuthenticatedHandler, make_singleuser_app
88

99
if os.environ.get("JUPYTERHUB_SINGLEUSER_EXTENSION", "") not in ("", "0"):
10+
_as_extension = True
1011
# check for conflict in singleuser entrypoint environment variables
1112
if os.environ.get("JUPYTERHUB_SINGLEUSER_APP", "") not in {
1213
"",
@@ -21,7 +22,6 @@
2122
f"Cannot use JUPYTERHUB_SINGLEUSER_EXTENSION={ext} with JUPYTERHUB_SINGLEUSER_APP={app}."
2223
" Please pick one or the other."
2324
)
24-
_as_extension = True
2525
from .extension import main
2626
else:
2727
_as_extension = False

jupyterhub/singleuser/mixins.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,12 +911,14 @@ def make_singleuser_app(App):
911911
empty_parent_app = App()
912912
log = empty_parent_app.log
913913

914-
# detect base classes
914+
# detect base handler classes
915915
if not getattr(empty_parent_app, "login_handler_class", None) and hasattr(
916916
empty_parent_app, "identity_provider_class"
917917
):
918+
# Jupyter Server 2 moves the login handler classes to the identity provider
918919
has_handlers = empty_parent_app.identity_provider_class(parent=empty_parent_app)
919920
else:
921+
# prior to Jupyter Server 2, the app itself had handler class config
920922
has_handlers = empty_parent_app
921923
LoginHandler = has_handlers.login_handler_class
922924
LogoutHandler = has_handlers.logout_handler_class

jupyterhub/singleuser/templates/page.html

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1-
{% extends "templates/page.html" %} {% block header_buttons %} {{super()}}
1+
{#
2+
this template customizes all pages (classic notebook, not jupyterlab) served by the single-user server
23

4+
It makes the following modifications:
5+
6+
- add jupyterhub control panel link to the header
7+
- update logo url to jupyterhub
8+
- remove `?redirects` url param that may be added by jupyterhub
9+
#}
10+
11+
{% extends "templates/page.html" %}
12+
13+
{% block header_buttons %}
14+
{{ super() }}
315
<span>
416
<a
517
href="{{hub_control_panel_url}}"
@@ -10,9 +22,14 @@
1022
Control Panel
1123
</a>
1224
</span>
13-
{% endblock %} {% block logo %}
25+
{% endblock %}
26+
27+
{% block logo %}
1428
<img src="{{logo_url}}" alt="Jupyter Notebook" />
15-
{% endblock logo %} {% block script %} {{ super() }}
29+
{% endblock logo %}
30+
31+
{% block script %}
32+
{{ super() }}
1633
<script type="text/javascript">
1734
function _remove_redirects_param() {
1835
// remove ?redirects= param from URL so that

0 commit comments

Comments
 (0)