Template system integration for fresco
Project description
Example usage with Jinja2:
from fresco import FrescoApp from fresco_template import Jinja2 from jinja2 import PackageLoader app = FrescoApp() jinja2 = Jinja2(loader=PackageLoader('mypackage', 'template/dir')) jinja2.init_app(app) @jinja2.contextprocessor def default_context(): # Return a dictionary of variables always to be included in the # template context. # # NB the fresco context object and urlfor function are already included # in the template context by default. return {} @jinja2.render('page.html') def myview(): return {'var': 'value'}
Same example with Chameleon:
from fresco import FrescoApp from fresco_template import Chameleon from chameleon import PageTemplateLoader app = FrescoApp() loader = PageTemplateLoader(['template/dir'], auto_reload=True) chameleon = Chameleon(loader) chameleon.init_app(app) @chameleon.contextprocessor def default_context(): # Return a dictionary of variables always to be included in the # template context. # # NB the fresco context object and urlfor function are already included # in the template context by default. return {} @chameleon.render('page.html') def myview(): return {'var': 'value'}
0.2
Initial release
0.1
(unreleased version)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fresco-template-0.2.tar.gz
(8.3 kB
view details)
File details
Details for the file fresco-template-0.2.tar.gz
.
File metadata
- Download URL: fresco-template-0.2.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b14b1dd18c0bd2c9ca6d5f975bb094a2db031335e65d35823a7252dddc0ad9d0
|
|
MD5 |
d80bdb433f5f7e044218f813a833b109
|
|
BLAKE2b-256 |
492df6cd43a8332a1d88ef02acfe4afc76986de6f0f44328a1b591184dab5d77
|