Skip to content

Commit

Permalink
handler loading
Browse files Browse the repository at this point in the history
  • Loading branch information
echarles committed Feb 26, 2020
1 parent 89c16c7 commit 2f3aa4b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions jupyterlab_server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class LabServerApp(ExtensionAppJinjaMixin, ExtensionApp):

# The name of the extension
extension_name = "lab"

# Te url that your extension will serve its homepage.
default_url = '/lab'

Expand Down Expand Up @@ -66,6 +66,6 @@ def initialize_templates(self):
)

def initialize_handlers(self):
add_handlers(self, self.serverapp.web_app, self.lab_config)
add_handlers(self.serverapp.web_app, self.lab_config)

main = launch_new_instance = LabServerApp.launch_instance
8 changes: 4 additions & 4 deletions jupyterlab_server/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ def is_url(url):
class LabHandler(ExtensionHandlerMixin, ExtensionHandlerJinjaMixin, JupyterHandler):
"""Render the JupyterLab View."""


def initialize(self, lab_config, **kwargs):
super().initialize(kwargs['extension_name'])
super().initialize('lab')
self.lab_config = lab_config
self.file_loader = FileSystemLoader(lab_config.templates_dir)

Expand Down Expand Up @@ -209,7 +210,7 @@ def render_template(self, name, **ns):
return self.render_lab_template(name, **ns)


def add_handlers(labserverapp, web_app, config):
def add_handlers(web_app, config):
"""Add the appropriate handlers to the web app.
"""
# Normalize directories.
Expand Down Expand Up @@ -310,8 +311,7 @@ def add_handlers(labserverapp, web_app, config):
fallthrough_url = ujoin(base_url, config.app_url, r'.*')
handlers.append((fallthrough_url, NotFoundHandler, {'lab_config': config}))

# web_app.add_handlers('.*$', handlers)
labserverapp.handlers.extend(handlers)
web_app.add_handlers('.*$', handlers)

def _camelCase(base):
"""Convert a string to camelCase.
Expand Down
2 changes: 1 addition & 1 deletion jupyterlab_server/settings_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _path(root_dir, schema_name, make_dirs=False, extension='.json'):
class SettingsHandler(ExtensionHandlerMixin, ExtensionHandlerJinjaMixin, APIHandler):

def initialize(self, app_settings_dir, schemas_dir, settings_dir, **kwargs):
super().initialize(kwargs['extension_name'])
super().initialize('lab')
self.overrides = dict()
self.schemas_dir = schemas_dir
self.settings_dir = settings_dir
Expand Down
2 changes: 1 addition & 1 deletion jupyterlab_server/workspaces_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def slugify(raw, base='', sign=True, max_length=128 - len(WORKSPACE_EXTENSION)):
class WorkspacesHandler(ExtensionHandlerMixin, ExtensionHandlerJinjaMixin, APIHandler):

def initialize(self, path, workspaces_url=None, **kwargs):
super().initialize(kwargs['extension_name'])
super().initialize('lab')
self.workspaces_dir = path

def ensure_directory(self):
Expand Down

0 comments on commit 2f3aa4b

Please sign in to comment.