No project description provided
Project description
Muffin-Jinja2 – Jinja2 template engine for Muffin framework.
Requirements
python >= 3.3
Installation
Muffin-Jinja2 should be installed using pip:
pip install muffin-jinja2
Usage
Add muffin_jinja2 to PLUGINS in your Muffin Application configuration.
Options
JINJA2_AUTO_RELOAD – Auto reload changed templates (False)
JINJA2_CACHE_SIZE – Cache templates (50)
JINJA2_EXTENSIONS – Enable Jinja2 Extensions (None)
JINJA2_LOADER – Template loader (FileSystemLoader)
JINJA2_ENCODING – Default encoding for file loader
JINJA2_TEMPLATE_FOLDERS – List of template folders ([‘templates’])
Views
# Register custom context processor # could be a function/coroutine @app.ps.jinja2.context_processor def custom_context(): return { 'VAR': 'VALUE' } # Register a function into global context @app.ps.jinja2.register def sum(a, b): return a + b # Register a function with a different name @app.ps.jinja2.register('div') def mod(a, b): return a // b # Register a filter @app.ps.jinja2.filter def test(value, a, b=None): return a if value else b # Register a filter with a different name @app.ps.jinja2.filter('bool') def boolean(value): return bool(value) @app.register('/') def index(request): """ Check for user is admin. """ local_context = {'key': 'value'} return app.ps.jinja2.render('index.html', **local_context)
Bug tracker
If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/muffin-jinja2/issues
Contributing
Development of Muffin-Jinja2 happens at: https://github.com/klen/muffin-jinja2
Contributors
klen (Kirill Klenov)
License
Licensed under a MIT license.
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 muffin-jinja2-0.2.4.tar.gz
.
File metadata
- Download URL: muffin-jinja2-0.2.4.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07e4e5118d64a108790ef056b53da933bf74d1c26dd25691daccb5ef8d44af3c |
|
MD5 | 33d70de93485c1f248bea013daf2890f |
|
BLAKE2b-256 | e3799bc0516fc53a6b62b1445d14b3d2a5870fd81c5e1b678b6eb18fa08d7599 |
File details
Details for the file muffin_jinja2-0.2.4-py2.py3-none-any.whl
.
File metadata
- Download URL: muffin_jinja2-0.2.4-py2.py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c69bbce358cd12d76bbba29eec41979a2a33d308664ca1022694b1516f05c45 |
|
MD5 | b86124a522ae4dc0d052ab234294494e |
|
BLAKE2b-256 | 16ac6e151cfe0d3b07b89f1c9e13582da857e836ed9cac481fa1e47fbe618ead |