## japronto_jinja2
[jinja2](http://jinja.pocoo.org) asynchronous template renderer for [japronto](https://github.com/squeaky-pl/japronto).
### Installation
Install from PyPI: ` pip install japronto-jinja2 `
### Developing
Install requirement and launch tests: ` pip install -e .[dev] pytest `
### Usage
Before template rendering you have to setup jinja2 environment first:
import jinja2
from japronto import Application
app = Application()
japronto_jinja2.setup(app, loader=jinja2.FileSystemLoader('/path/to/templates/folder'))
After that you may to use template engine in your web-handlers. The most convenient way is to decorate a web-handler.
Using the function based web handlers:
@ajapronto_jinja2.template('tmpl.jinja2')
def handler(request):
return {'action': 'follow', 'person': 'me'}
On handler call the japronto_jinja2.template decorator will pass returned dictionary {‘action’: ‘follow’, ‘person’: ‘me’} into template named tmpl.jinja2 for getting resulting HTML text.
If you need more complex processing (modify response on your own) you may call render_template function.
Using a function based web handler:
async def handler(request):
context = {'action': 'unsubscribe', 'from': 'channel'}
response = aiohttp_jinja2.render_template('tmpl.jinja2',
request,
context)
# do smth with your response
return response
See [examples](https://github.com/bmwant/japronto-jinja2/tree/master/examples) directory for more complete snippets.
### License
japronto_jinja2 is offered under the Apache 2 license.
CHANGES
0.0.1 (2016-05-10)
Initial release
Metadata
Release files for japronto-jinja2 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| japronto_jinja2-0.0.1.tar.gz | 45.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| japronto_jinja2-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.0 kB
Release files / japronto_jinja2-0.0.1.tar.gz
| Download URL | japronto_jinja2-0.0.1.tar.gz |
|---|---|
| Size | 45.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7890d395bbd05ef51665826fb222643dfa7b0e01dcd084f0a8f6452d583d0f5
|
|
BLAKE2b-256 checksum How to use checksums |
853af3f37ba10529b04d0dc488b899e0d098d4d8e3fded31b9d0fdb5a55d52ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / japronto_jinja2-0.0.1-py3-none-any.whl
| Download URL | japronto_jinja2-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d86d2bda9d694a10c66140b661ef53844f19ce3845cbc534f792263fda628c8
|
|
BLAKE2b-256 checksum How to use checksums |
d7e74e53cf14c11b656e5394629993dbfb84e01c1531aa46a0cef5f096e34f78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for japronto-jinja2 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.