Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added feature to include jinja template context in startpage #368

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion eel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ===
Expand Down Expand Up @@ -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)
Expand Down