Skip to content

Commit 46b747f

Browse files
authored
Merge pull request #185 from davidbrochart/no_ssl_options
Fix bug when ssl_options is None
2 parents 33cf8e6 + a8cfffa commit 46b747f

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

jupyter_server/serverapp.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,8 @@ def _token_default(self):
767767

768768
max_body_size = Integer(512 * 1024 * 1024, config=True,
769769
help="""
770-
Sets the maximum allowed size of the client request body, specified in
771-
the Content-Length request header field. If the size in a request
770+
Sets the maximum allowed size of the client request body, specified in
771+
the Content-Length request header field. If the size in a request
772772
exceeds the configured value, a malformed HTTP message is returned to
773773
the client.
774774
@@ -778,7 +778,7 @@ def _token_default(self):
778778

779779
max_buffer_size = Integer(512 * 1024 * 1024, config=True,
780780
help="""
781-
Gets or sets the maximum amount of memory, in bytes, that is allocated
781+
Gets or sets the maximum amount of memory, in bytes, that is allocated
782782
for use by the buffer manager.
783783
"""
784784
)
@@ -1313,7 +1313,8 @@ def init_webapp(self):
13131313
self.ssl_options['keyfile'] = self.keyfile
13141314
if self.client_ca:
13151315
self.ssl_options['ca_certs'] = self.client_ca
1316-
if len(self.ssl_options) == 0:
1316+
if not self.ssl_options:
1317+
# could be an empty dict or None
13171318
# None indicates no SSL config
13181319
self.ssl_options = None
13191320
else:
@@ -1353,7 +1354,7 @@ def display_url(self):
13531354
self.get_url(ip=ip, path=path, token=token)
13541355
+ '\n or '
13551356
+ self.get_url(ip='127.0.0.1', path=path, token=token)
1356-
)
1357+
)
13571358
return url
13581359

13591360
@property
@@ -1466,7 +1467,7 @@ def init_server_extension_config(self):
14661467
"""Consolidate server extensions specified by all configs.
14671468
14681469
The resulting list is stored on self.jpserver_extensions and updates config object.
1469-
1470+
14701471
The extension API is experimental, and may change in future releases.
14711472
"""
14721473
# Load server extensions with ConfigManager.
@@ -1491,7 +1492,7 @@ def init_server_extensions(self):
14911492
14921493
Import the module, then call the load_jupyter_server_extension function,
14931494
if one exists.
1494-
1495+
14951496
The extension API is experimental, and may change in future releases.
14961497
"""
14971498
# Initialize extensions
@@ -1570,16 +1571,16 @@ def http_server(self):
15701571

15711572
def init_httpserver(self):
15721573
"""Creates an instance of a Tornado HTTPServer for the Server Web Application
1573-
and sets the http_server attribute.
1574+
and sets the http_server attribute.
15741575
"""
15751576
# Check that a web_app has been initialized before starting a server.
15761577
if not hasattr(self, 'web_app'):
15771578
raise AttributeError('A tornado web application has not be initialized. '
15781579
'Try calling `.init_webapp()` first.')
1579-
1580+
15801581
# Create an instance of the server.
15811582
self._http_server = httpserver.HTTPServer(
1582-
self.web_app,
1583+
self.web_app,
15831584
ssl_options=self.ssl_options,
15841585
xheaders=self.trust_xheaders,
15851586
max_body_size=self.max_body_size,
@@ -1643,11 +1644,11 @@ def initialize(self, argv=None, load_extensions=True, new_httpserver=True):
16431644
----------
16441645
argv: list or None
16451646
CLI arguments to parse.
1646-
1647+
16471648
load_extensions: bool
16481649
If True, the server will load server extensions listed in the jpserver_extension trait.
16491650
Otherwise, no server extensions will be loaded.
1650-
1651+
16511652
new_httpserver: bool
16521653
If True, a tornado HTTPServer instance will be created and configured for the Server Web
16531654
Application. This will set the http_server attribute of this class.

0 commit comments

Comments
 (0)