Jinja2 Extension for Raise Error
Project description
Jinja2 Extension for Raise Error
Installation
jinja2_error is available for download from PyPI via pip:
$ pip install jinja2_error
Usage
Error Tag
The extension comes with a error tag that provides convenient to raise error`.
def test_raise_error(self):
env = Environment(extensions=[ErrorExtension])
render_text = """
{% if 1==1 %}
{% error "It's error" %}
{% endif %}
"""
template = env.from_string(render_text)
self.assertRaises(TemplateRuntimeError, template.render, {"a": "b"})
Ansible Template Usage
ANSIBLE_JINJA2_EXTENSIONS=jinja2_error.ErrorExtension ansible-playbook site.yml -vvv
Issues
If you encounter any problems, please file an issue along with a detailed description.
Code of Conduct
Everyone interacting in the jinja2_error project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.
License
Distributed under the terms of the MIT license, jinja2_error is free and open source software
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 jinja2_error-0.1.0.tar.gz
.
File metadata
- Download URL: jinja2_error-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
58b785ba4eaf03c5b0bc2abe6a5efe6605406fb12664fa2ae2195234852eb033
|
|
MD5 |
f91056e855dc3961b8fe7f6f3e674faa
|
|
BLAKE2b-256 |
0c94d5594dad929477c5e47cbbfaefa9a006e8348e9971f7a7d72b1f904a6830
|
File details
Details for the file jinja2_error-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: jinja2_error-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
cb0e017905da4243460e92fe52d266d0a24461727101c85dff9aa50478bacec4
|
|
MD5 |
3ba3f0a0309d77694e41fb35bf81281e
|
|
BLAKE2b-256 |
c2b56669ec0954ec018d7de285a166b7713bf78d17fffe830343a5bd6abd5ce1
|