##// END OF EJS Templates
Backport PR #8196: DEV: Allow supplying jinja vars from python config....
Min RK -
Show More
@@ -119,6 +119,11 b' class IPythonHandler(AuthenticatedHandler):'
119 119 return Application.instance().log
120 120 else:
121 121 return app_log
122
123 @property
124 def jinja_template_vars(self):
125 """User-supplied values to supply to jinja templates."""
126 return self.settings.get('jinja_template_vars', {})
122 127
123 128 #---------------------------------------------------------------
124 129 # URLs
@@ -250,6 +255,7 b' class IPythonHandler(AuthenticatedHandler):'
250 255 sys_info=sys_info,
251 256 contents_js_source=self.contents_js_source,
252 257 version_hash=self.version_hash,
258 **self.jinja_template_vars
253 259 )
254 260
255 261 def get_json_body(self):
@@ -200,6 +200,7 b' class NotebookWebApplication(web.Application):'
200 200 config_manager=config_manager,
201 201
202 202 # IPython stuff
203 jinja_template_vars=ipython_app.jinja_template_vars,
203 204 nbextensions_path=ipython_app.nbextensions_path,
204 205 websocket_url=ipython_app.websocket_url,
205 206 mathjax_url=ipython_app.mathjax_url,
@@ -527,6 +528,11 b' class NotebookApp(BaseIPythonApplication):'
527 528
528 529 jinja_environment_options = Dict(config=True,
529 530 help="Supply extra arguments that will be passed to Jinja environment.")
531
532 jinja_template_vars = Dict(
533 config=True,
534 help="Extra variables to supply to jinja templates when rendering.",
535 )
530 536
531 537 enable_mathjax = Bool(True, config=True,
532 538 help="""Whether to enable MathJax for typesetting math/TeX
@@ -25,6 +25,7 b' window.mathjax_url = "{{mathjax_url}}";'
25 25
26 26 {% block params %}
27 27
28 {{super()}}
28 29 data-project="{{project}}"
29 30 data-base-url="{{base_url}}"
30 31 data-ws-url="{{ws_url}}"
@@ -4,7 +4,7 b''
4 4
5 5
6 6 {% block params %}
7
7 {{super()}}
8 8 data-base-url="{{base_url}}"
9 9 data-notebook-path="{{notebook_path}}"
10 10 data-terminals-available="{{terminals_available}}"
General Comments 0
You need to be logged in to leave comments. Login now