File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 4
4
from traitlets import (
5
5
Unicode ,
6
6
List ,
7
- Dict ,
7
+ Dict ,
8
+ Bool ,
8
9
default ,
9
10
validate
10
11
)
@@ -80,6 +81,12 @@ def _preparse_for_stopping_flags(Application, argv):
80
81
app .exit (0 )
81
82
82
83
84
+ flags ['no-browser' ]= (
85
+ {'ExtensionApp' : {'open_browser' : True }},
86
+ _ ("Prevent the opening of the default url in the browser." )
87
+ )
88
+
89
+
83
90
class ExtensionApp (JupyterApp ):
84
91
"""Base class for configurable Jupyter Server Extension Applications.
85
92
@@ -176,6 +183,11 @@ def _config_file_name_default(self):
176
183
help = _ ("The default URL to redirect to from `/`" )
177
184
)
178
185
186
+ open_browser = Bool (
187
+ True ,
188
+ help = _ ("Should the extension open a browser window?" )
189
+ )
190
+
179
191
custom_display_url = Unicode (u'' , config = True ,
180
192
help = _ ("""Override URL shown to users.
181
193
@@ -335,7 +347,7 @@ def start(self):
335
347
# Override the server's display url to show extension's display URL.
336
348
self .serverapp .custom_display_url = self .custom_display_url
337
349
# Override the server's default option and open a broswer window.
338
- self .serverapp .open_browser = True
350
+ self .serverapp .open_browser = self . open_browser
339
351
# Hijack the server's browser-open file to land on
340
352
# the extensions home page.
341
353
self .serverapp ._write_browser_open_file = self ._write_browser_open_file
You can’t perform that action at this time.
0 commit comments