TAL template renderer for aiohttp.web (http server for asyncio)
Project description
aiohttp_tal
TAL Chameleon template engine renderer for aiohttp.web. Based on aiohttp_jinja2.
Installation
Install from PyPI:
pip install aiohttp-tal
Developing
Install requirement and launch tests:
pip install -r requirements-dev.txt pytest tests
Usage
For more details on usage, see https://aiohttp-tal.readthedocs.io/en/latest/usage.html.
Before template rendering you have to setup TAL environment first:
app = web.Application()
aiohttp_tal.setup(app,
loader=chameleon.PageTemplateLoader('/path/to/templates/folder'))
Import:
import aiohttp_tal
import chameleon
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:
@aiohttp_tal.template('tmpl.pt')
def handler(request):
return {'name': 'Andrew', 'surname': 'Svetlov'}
License
aiohttp_tal is offered under the GPLv3 license.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
CHANGES
0.1.0 (2019-03-28)
Initial release. Based on aiohttp-jinja2 copyright by Andrew Svetlo and aio-libs team.
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
File details
Details for the file aiohttp-tal-0.1.0.tar.gz
.
File metadata
- Download URL: aiohttp-tal-0.1.0.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dca0afc76079ca25828ab5e83d06c66f3def0bcfbda7414a2d5c5ba24499114 |
|
MD5 | 329bf7501de35705b9fa63121a97785e |
|
BLAKE2b-256 | 7a5ad39d9a72f021c848cbbeb5c258a49922a8677e18671b7eacbb0f3144db12 |