mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-18 23:42:59 +00:00
Always enable the base templates feature
This commit is contained in:
@@ -265,17 +265,13 @@ class JupyterHub(Application):
|
|||||||
).tag(config=True)
|
).tag(config=True)
|
||||||
|
|
||||||
template_paths = List(
|
template_paths = List(
|
||||||
help="Paths to search for jinja templates.",
|
help="Paths to search for jinja templates, before using the default templates.",
|
||||||
).tag(config=True)
|
).tag(config=True)
|
||||||
|
|
||||||
@default('template_paths')
|
@default('template_paths')
|
||||||
def _template_paths_default(self):
|
def _template_paths_default(self):
|
||||||
return [os.path.join(self.data_files_path, 'templates')]
|
return [os.path.join(self.data_files_path, 'templates')]
|
||||||
|
|
||||||
base_templates = Bool(False,
|
|
||||||
help="Allow tempates to extend the base versions, by referencing 'BASE:name.html'."
|
|
||||||
).tag(config=True)
|
|
||||||
|
|
||||||
confirm_no_ssl = Bool(False,
|
confirm_no_ssl = Bool(False,
|
||||||
help="""DEPRECATED: does nothing"""
|
help="""DEPRECATED: does nothing"""
|
||||||
).tag(config=True)
|
).tag(config=True)
|
||||||
@@ -1298,16 +1294,13 @@ class JupyterHub(Application):
|
|||||||
autoescape=True,
|
autoescape=True,
|
||||||
)
|
)
|
||||||
jinja_options.update(self.jinja_environment_options)
|
jinja_options.update(self.jinja_environment_options)
|
||||||
if self.base_templates:
|
base_path = self._template_paths_default()[0]
|
||||||
base_path = self._template_paths_default()[0]
|
if base_path not in self.template_paths:
|
||||||
if base_path not in self.template_paths:
|
self.template_paths.append(base_path)
|
||||||
self.template_paths.append(base_path)
|
loader = ChoiceLoader([
|
||||||
loader = ChoiceLoader([
|
PrefixLoader({'BASE': FileSystemLoader([base_path])}, ':'),
|
||||||
PrefixLoader({'BASE': FileSystemLoader([base_path])}, ':'),
|
FileSystemLoader(self.template_paths)
|
||||||
FileSystemLoader(self.template_paths)
|
])
|
||||||
])
|
|
||||||
else:
|
|
||||||
loader = FileSystemLoader(self.template_paths)
|
|
||||||
jinja_env = Environment(
|
jinja_env = Environment(
|
||||||
loader=loader,
|
loader=loader,
|
||||||
**jinja_options
|
**jinja_options
|
||||||
|
Reference in New Issue
Block a user