aiohttp_tal¶
TAL Chameleon template engine renderer for aiohttp.web. Based on aiohttp_jinja2.
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/>.
Source code¶
The project is hosted on GitHub.
Please feel free to file an issue on bug tracker if you have found a bug or have some suggestion for library improvement.
The project uses Travis for Continuous Integration.
Glossary¶
- METAL
- Macro Expansion TAL
- TAL
- Template Attribute Language. See https://chameleon.readthedocs.io/en/latest/reference.html
- TALES
- TAL Expression Syntax
- web-handler
- An endpoint that returns http response.