fresco-template - Templating for Fresco
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.1
The TemplateContent class now calls all context processors on instantiation. This ensures context processors are always called before response headers are sent.
0.2
Initial release
0.1
(unreleased version)
Metadata
Release files for fresco-template 0.2.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 | Actions |
|---|---|---|---|---|
| fresco-template-0.2.1.tar.gz | 8.6 kB | Without provenance | Details for fresco-template-0.2.1.tar.gz |
Release files / fresco-template-0.2.1.tar.gz
| Download URL | fresco-template-0.2.1.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd4cea5e81650ab0f31ebf5fc28ff1a1d84fe49762aa03de5ecc6100dbe7aae6
|
|
BLAKE2b-256 checksum How to use checksums |
9401d68c6a2b3c81f7dc43ff70fc7a51bc12ce1b2cdef15548f9817d41e74f15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for fresco-template 0.2.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.