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

pass extension_name to only extension app handlers #69

Merged
merged 1 commit into from
Aug 3, 2019
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions jupyter_server/extension/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from jupyter_server.serverapp import ServerApp, aliases, flags
from jupyter_server.transutils import _
from jupyter_server.utils import url_path_join

from .handler import ExtensionHandler

# Remove alias for nested classes in ServerApp.
# Nested classes are not allowed in ExtensionApp.
Expand Down Expand Up @@ -181,11 +181,12 @@ def _prepare_handlers(self):

# Get handler kwargs, if given
kwargs = {}
if issubclass(handler, ExtensionHandler):
kwargs['extension_name'] = self.extension_name
try:
kwargs.update(handler_items[2])
except IndexError:
pass
kwargs['extension_name'] = self.extension_name

new_handler = (pattern, handler, kwargs)
new_handlers.append(new_handler)
Expand Down
3 changes: 1 addition & 2 deletions jupyter_server/extension/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ class ExtensionHandler(JupyterHandler):
their own namespace and avoid intercepting requests for
other extensions.
"""
def initialize(self, extension_name, **kwargs):
def initialize(self, extension_name):
self.extension_name = extension_name
super(ExtensionHandler, self).initialize(**kwargs)

@property
def config(self):
Expand Down