Skip to content

Commit

Permalink
Merge pull request #121 from ChrisKnott/shw-only-render-templates
Browse files Browse the repository at this point in the history
Only render jinja templates
  • Loading branch information
ChrisKnott authored Feb 24, 2019
2 parents da4198c + 07706ac commit 5e551f3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Change log

### v0.10.2
* Only render templates from within the declared jinja template directory.

### v0.10.1
* Avoid name collisions when using Electron, so jQuery etc work normally

## v0.10.0
* Corrective version bump after new feature included in 0.9.13
* Fix a bug with example 06 for Jinja templating; the `templates` kwarg to `eel.start` takes a filepath, not a bool.

## v0.9.13
### v0.9.13
* Add support for Jinja templating.

## Earlier
### Earlier
* No changelog notes for earlier versions.
10 changes: 6 additions & 4 deletions eel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ def _eel():

@btl.route('/<path:path>')
def _static(path):
if _jinja_env != None:
n = len(_jinja_templates + '/')
template_prefix = _jinja_templates + '/'

if _jinja_env != None and path.startswith(template_prefix):
n = len(template_prefix)
template = _jinja_env.get_template(path[n:])
return template.render()
else:
return btl.static_file(path, root=root_path)

return btl.static_file(path, root=root_path)


@btl.get('/eel', apply=[wbs.websocket])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='Eel',
version='0.10.1',
version='0.10.2',
author='Chris Knott',
author_email='[email protected]',
packages=['eel'],
Expand Down

0 comments on commit 5e551f3

Please sign in to comment.