Skip to content

Commit

Permalink
minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsailer committed Mar 3, 2020
1 parent 2bcf210 commit 4e2e989
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions jupyter_server/extension/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class ExtensionAppJinjaMixin:

jinja2_options = Dict(
help=_("""Options to pass to the jinja2 environment for this
extension.
""")
).tag(config=True)

Expand Down Expand Up @@ -283,6 +282,7 @@ def _prepare_config(self):
"""Builds a Config object from the extension's traits and passes
the object to the webapp's settings as `<extension_name>_config`.
"""
# Verify all traits are up-to-date with config
self.update_config(self.config)
traits = self.class_own_traits().keys()
self.extension_config = Config({t: getattr(self, t) for t in traits})
Expand Down Expand Up @@ -382,6 +382,7 @@ def initialize(self, serverapp, argv=None):
# If argv is given, parse and update config.
if argv:
self.parse_command_line(argv)

# Load config from file.
self.load_config_file()

Expand Down Expand Up @@ -421,7 +422,7 @@ def load_jupyter_server_extension(cls, serverapp):
"""
# Configure and initialize extension.
extension = cls(parent=serverapp)
extension.initialize(serverapp)
extension.initialize(serverapp=serverapp)
return extension

@classmethod
Expand Down
10 changes: 5 additions & 5 deletions jupyter_server/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def mkdir(tmp_path, *parts):
return path


config = pytest.fixture(lambda: {})
server_config = pytest.fixture(lambda: {})
home_dir = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "home"))
data_dir = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "data"))
config_dir = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "config"))
Expand Down Expand Up @@ -111,10 +111,10 @@ def extension_environ(env_config_path, monkeypatch):

@pytest.fixture
def configurable_serverapp(
environ, http_port, tmp_path, home_dir, data_dir, config_dir, runtime_dir, root_dir, io_loop
environ, http_port, tmp_path, home_dir, data_dir, config_dir, runtime_dir, root_dir, io_loop, server_config, **kwargs
):
def serverapp(
config={},
config=server_config,
argv=[],
environ=environ,
http_port=http_port,
Expand Down Expand Up @@ -160,8 +160,8 @@ def serverapp(


@pytest.fixture
def serverapp(configurable_serverapp, config, argv):
app = configurable_serverapp(config=config, argv=argv)
def serverapp(configurable_serverapp, server_config, argv):
app = configurable_serverapp(config=server_config, argv=argv)
yield app
app.remove_server_info_file()
app.remove_browser_open_file()
Expand Down
2 changes: 1 addition & 1 deletion jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,6 @@ def init_webapp(self):
self.ssl_options['ca_certs'] = self.client_ca
if not self.ssl_options:
# could be an empty dict or None
# None indicates no SSL config
self.ssl_options = None
else:
# SSL may be missing, so only import it if it's to be used
Expand All @@ -1329,6 +1328,7 @@ def init_webapp(self):
)
if self.ssl_options.get('ca_certs', False):
self.ssl_options.setdefault('cert_reqs', ssl.CERT_REQUIRED)
ssl_options = self.ssl_options

self.login_handler_class.validate_security(self, ssl_options=self.ssl_options)

Expand Down

0 comments on commit 4e2e989

Please sign in to comment.