Helper for rendering Jinja2 templates in charms
Python Makefile
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
charms
docs
tests
.gitignore
.travis.yml
LICENSE
MANIFEST.in
Makefile
README.rst
VERSION
requirements.txt
setup.cfg
setup.py
test_requirements.txt
tox.ini

README.rst

charms.templating.jinja2 badge

Helper for rendering Jinja2 templates with charms

Usage

from charms.templating.jinja2 import render

render('app.conf.j2', '/etc/app.conf', {
    'my_var': 'my_val',
})

output = render(
    'tmpl.j2',
    tests={
        'isnumeric': lambda s: s.isnumeric(),
    })

output = render(
    template='{{ config["my-opt"]|my_upper }}',
    filters={
        'my_upper': lambda s: s.upper(),
    })

The full documentation is available at http://pythonhosted.org/charms.templating.jinja2/