Latest Version: 0.9.6.2

Warning

This documentation does not refer to the most recent version of Pylons. Current Documentation

Buffet

Buffet style plug-in template rendering

Buffet implements template language plug-in support modeled highly on the Buffet Project from which this class inherits its name.


Methods

f __init__(self) ...

f prepare(self, engine_name, template_root=None) ...

Prepare a template engine for use

This method must be run every request before the render method is called so that the template_root can be set.

f render(self, engine_name, template_name, as_string=False, include_pylons_variables=True, namespace=None) ...

Render a template using a template engine plug-in

To use templates it is expected that you will attach data to be used in the template to the c variable which is available in the controller and the template.

When porting code from other projects it is sometimes easier to use an exisitng dictionary which can be specified with namespace.

engine_name
The name of the template engine to use, which must be 'prepared' first.
template_name
Name of the template to render
as_string
Whether or not to directly render the output to the browser, or return the rendered template as a string.
include_pylons_variables
If a custom namespace is specified this determines whether Pylons variables are included in the namespace or not. Defaults to True.
namespace
A custom dictionary of names and values to be substituted in the template. If include_pylons_variables is True and any keys in namespace conflict with names of Pylons variables, an error is raised.

All other keyword options are passed directly to the template engine used.

See the source for more information.

Top