|
12 | 12 | from traitlets import default
|
13 | 13 | from traitlets import Dict
|
14 | 14 | from traitlets import HasTraits
|
| 15 | +from traitlets import Instance |
15 | 16 | from traitlets import List
|
16 | 17 | from traitlets import Unicode
|
17 | 18 | from traitlets.config import Config
|
@@ -103,7 +104,7 @@ def _prepare_templates(self):
|
103 | 104 | loader=FileSystemLoader(self.template_paths),
|
104 | 105 | extensions=["jinja2.ext.i18n"],
|
105 | 106 | autoescape=True,
|
106 |
| - **self.jinja2_options |
| 107 | + **self.jinja2_options, |
107 | 108 | )
|
108 | 109 |
|
109 | 110 | # Add the jinja2 environment for this extension to the tornado settings.
|
@@ -162,6 +163,12 @@ class method. This method can be set as a entry_point in
|
162 | 163 | def _default_open_browser(self):
|
163 | 164 | return self.serverapp.config["ServerApp"].get("open_browser", True)
|
164 | 165 |
|
| 166 | + @property |
| 167 | + def config_file_paths(self): |
| 168 | + """Look on the same path as our parent for config files""" |
| 169 | + # rely on parent serverapp, which should control all config loading |
| 170 | + return self.serverapp.config_file_paths |
| 171 | + |
165 | 172 | # The extension name used to name the jupyter config
|
166 | 173 | # file, jupyter_{name}_config.
|
167 | 174 | # This should also match the jupyter subcommand used to launch
|
@@ -200,7 +207,17 @@ def _default_url(self):
|
200 | 207 | ]
|
201 | 208 |
|
202 | 209 | # A ServerApp is not defined yet, but will be initialized below.
|
203 |
| - serverapp = None |
| 210 | + serverapp = Instance(ServerApp) |
| 211 | + |
| 212 | + @default("serverapp") |
| 213 | + def _default_serverapp(self): |
| 214 | + # load the current global instance, if any |
| 215 | + if ServerApp.initialized(): |
| 216 | + return ServerApp.instance() |
| 217 | + else: |
| 218 | + # serverapp accessed before it was defined, |
| 219 | + # declare an empty one |
| 220 | + return ServerApp() |
204 | 221 |
|
205 | 222 | _log_formatter_cls = LogFormatter
|
206 | 223 |
|
|
0 commit comments