@@ -20,17 +20,20 @@ def _jupyter_server_extension_points():
2020 }]
2121
2222
23- def _load_jupyter_server_extension (nbapp ):
23+ def _load_jupyter_server_extension (app ):
2424 """
2525 This function is a hook for `notebook` and `jupyter_server` that we use to
2626 register additional endpoints to be handled by nbgitpuller.
2727
28+ Note that as this function is used as a hook for both notebook and
29+ jupyter_server, the argument passed may be a NotebookApp or a ServerApp.
30+
2831 Related documentation:
2932 - notebook: https://jupyter-notebook.readthedocs.io/en/stable/extending/handlers.htmland
3033 - notebook: https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html#Example---Server-extension
3134 - jupyter_server: https://jupyter-server.readthedocs.io/en/latest/developers/extensions.html
3235 """
33- web_app = nbapp .web_app
36+ web_app = app .web_app
3437 base_url = url_path_join (web_app .settings ['base_url' ], 'git-pull' )
3538 handlers = [
3639 (url_path_join (base_url , 'api' ), SyncHandler ),
@@ -43,7 +46,10 @@ def _load_jupyter_server_extension(nbapp):
4346 {'path' : os .path .join (os .path .dirname (__file__ ), 'static' )}
4447 )
4548 ]
46- web_app .settings ['nbapp' ] = nbapp
49+ # FIXME: See note on how to stop relying on settings to pass information:
50+ # https://github.com/jupyterhub/nbgitpuller/pull/242#pullrequestreview-854968180
51+ #
52+ web_app .settings ['nbapp' ] = app
4753 web_app .add_handlers ('.*' , handlers )
4854
4955
0 commit comments