Jinja2 template integration for Morepath
Project description
more.jinja2: Jinja2 template integration for Morepath
more.jinja2 is an extension for Morepath that adds Jinja2 template support when you use the .jinja2 extension.
For details on the Jinja2 template language see the Jinja2 template designer documentation.
Example usage:
from more.jinja2 import Jinja2App class App(Jinja2App): pass @App.path(path='persons/{name}') class Person(object): def __init__(self, name): self.name = name @App.template_directory() def get_template_directory(): return 'templates' @App.html(model=Person, template='person.jinja2') def person_default(self, request): return {'name': self.name}
and then in person.jinja2 (in the templates subdirectory):
<html> <body> <p>Hello {{name}}!</p> </body> </html>
Note that the Jinja2 documentation uses the .html extension for Jinja2 templates, whereas this extension uses .jinja2 instead.
To control Jinja2 behavior you can define a jinja2 setting section in your app. For instance:
@App.setting_section(section='jinja2') def get_setting_section(): return { 'auto_reload': False, 'autoescape': True, }
For details on Jinja2 configuration options, consult the Jinja2 API documentation.
CHANGES
0.3 (2022-05-29)
Apply pyupgrade --py36-plus
Use black code formatter.
Add support for Python 3.7, 3.8, 3.9 and 3.10.
Fix test collection.
Drop support for Python 2.7, 3.4, 3.5.
Updated the test suite to work with Morepath 0.15.
Set up integration with Travis CI. (superseded)
Added Tox environments for Python 3.5 and 3.6, PyPy 3, PEP8. (partially superseded)
Using Python 3.5 for PEP8 and coverage. (superseded)
Clean up meta data.
Use GitHub Actions for CI.
Fix Jinja2 integration - the autoescape extension was removed as now it is built-in.
0.2 (2015-04-09)
Actual release to PyPI.
0.1 (2015-04-09)
Initial public release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file more.jinja2-0.3.tar.gz
.
File metadata
- Download URL: more.jinja2-0.3.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/30.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.2.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb4a87972aee309e1c3304f6eaffb982217fb6934fbf165236f0cee80369843b |
|
MD5 | 39adfcbfb8659b2e1dab4a1c3a761f4a |
|
BLAKE2b-256 | 3aced360f7650a5681733c4f35e6509416d5b0a16d368773088fbc773447b8d7 |
File details
Details for the file more.jinja2-0.3-py3-none-any.whl
.
File metadata
- Download URL: more.jinja2-0.3-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/30.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.2.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78f37d8937188c94384cc8b720e6adeced01c1fa34b4b7abfe0e5022faf58851 |
|
MD5 | a628c051b8700eccffaf1c62e1db5a09 |
|
BLAKE2b-256 | bd4d2aede313a7e8a7f1ac5135c8c58cf165c6700c6409c96ef45fbfd8bfe89b |