From fb04dbf102c47cb7574dcc851e41452738b710fb Mon Sep 17 00:00:00 2001 From: Enyioma Osondu Date: Mon, 27 Jul 2020 09:24:27 +0100 Subject: [PATCH] added feature to include jinja template context in startpage --- eel/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eel/__init__.py b/eel/__init__.py index 2f28ce89..8d32c6c2 100644 --- a/eel/__init__.py +++ b/eel/__init__.py @@ -50,6 +50,7 @@ 'disable_cache': True, # Sets the no-store response header when serving assets 'default_path': 'index.html', # The default file to retrieve for the root URL 'app': btl.default_app(), # Allows passing in a custom Bottle instance, e.g. with middleware + 'context': {}, # Allows passing of a context into jinja template } # == Temporary (suppressable) error message to inform users of breaking API change for v1.0.0 === @@ -205,7 +206,7 @@ def _static(path): if path.startswith(template_prefix): n = len(template_prefix) template = _start_args['jinja_env'].get_template(path[n:]) - response = btl.HTTPResponse(template.render()) + response = btl.HTTPResponse(template.render(_start_args['context'])) if response is None: response = btl.static_file(path, root=root_path)