Skip to main content

chameleon.genshi template bindings for the repoze.bfg web framework

Project description


Bindings for Chameleon Genshi-style templating support under repoze.bfg. See the Chameleon website for chameleon.genshi templating language details.

The API for use of repoze.bfg.chameleon_genshi under BFG is identical to the one used for chameleon.zpt` templates as documented in the “Templating” chapter of the BFG docs. Only the templating language itself (Genshi vs. ZPT) and import locations (r.b.chameleon_genshi vs. r.b.chameleon_zpt) differ.

An example:

from repoze.bfg.chameleon_genshi import render_template_to_response

relative/path/to/template is relative to the package directory in which the above code is defined.

See also the render_template and get_template APIs exposed by the repoze.bfg.chameleon_genshi package, which serve the same purpose as their brethren in repoze.bfg.chameleon_zpt.

Genshi templates can also be used as a BFG “renderer” when you use repoze.bfg.chameleon_genshi. The easiest way to allow for this is to use the following ZCML in your application’s configure.zcml:

<include package="repoze.bfg.chameleon_genshi"/>

Once your application has been set up to process this ZCML, your application can point at chameleon.genshi templates that have the .genshi file extension from within @bfg_view directives or ZCML view directives in your application. For example:

def someview(request):



If you’d rather not use a .genshi extension for your chameleon.genshi templates, or if you’d rather not use ZCML to do registration, you can explicitly register a renderer using the add_renderer method of a “configurator”. To do so, in the of your BFG application, in the function called at startup, which uses a repoze.bfg.configuration.Configurator as config:

from repoze.bfg.chameleon_genshi import renderer_factory
config.add_renderer('.cgenshi', renderer_factory)

Once you’ve registered .cgenshi as a renderer in a view configuration, you can do the following:

def someview(request):


0.2 (2010-06-15)

  • Bring up to speed with BFG 1.3.X.

0.1 (2009-05-02)

  • Initial release (break code out of BFG core).

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for repoze.bfg.chameleon_genshi, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size repoze.bfg.chameleon_genshi-0.2.tar.gz (6.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page