Skip to main content

No project description provided

Project description

Muffin-Jinja2 – Jinja2 template engine for Muffin framework.

Build Status http://img.shields.io/pypi/v/muffin-jinja2.svg?style=flat-square http://img.shields.io/pypi/dm/muffin-jinja2.svg?style=flat-square Donate

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 filter
@app.ps.jinja2.filter
def test(value, a, b=None):
    return a if value else b

@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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muffin-jinja2-0.0.4.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

muffin_jinja2-0.0.4-py2.py3-none-any.whl (5.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file muffin-jinja2-0.0.4.tar.gz.

File metadata

File hashes

Hashes for muffin-jinja2-0.0.4.tar.gz
Algorithm Hash digest
SHA256 0f14144b2ccc7c8433d60a5932a449f0576fabe507cabd70595fbaaab305e26c
MD5 1f6b5c68df52f1e8365f75fad3aa7d75
BLAKE2b-256 61196c8fc1d3ff4d8244d38cfbddec421cd64ebfafa2c6057431ac0619480214

See more details on using hashes here.

File details

Details for the file muffin_jinja2-0.0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for muffin_jinja2-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b3a43f1c3908090b22066d90e7c7e303b6c2b3f180acd8a5118f4d403aabd5ff
MD5 e9fcdb66b7927f25a1c4b2817da0f67f
BLAKE2b-256 89d61edec04140113e2c881bb90e6f1ca157eb49b318828e1aea556fe97b3dfc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page