Skip to main content

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)

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)

Source distribution for fresco-template 0.2.1
File Size Uploaded
fresco-template-0.2.1.tar.gz 8.6 kB Details

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

Release history Release notifications | RSS feed

1.0.0

2 release files

0.3.1

1 release file

0.3.0

1 release file

This release

0.2.1 This release

1 release file

0.2

1 release file

0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page