Warning
This documentation does not refer to the most recent version of Pylons. Current Documentation
The templating module is accessible via the pylons module.
The Buffet object is styled after the original Buffet module that implements template language neutral rendering for CherryPy. This version of Buffet also contains caching functionality that utilizes Beaker middleware to provide template language neutral caching functionality.
A customized version of BuffetMyghty is included that provides a template API hook as the pylonsmyghty engine. This version of BuffetMyghty disregards some of the TurboGears API spec so that traditional Myghty template names can be used with / and file extensions.
The render functions are intended as the primary user-visible rendering commands and hook into Buffet to make rendering content easy.
Render a template and return it as a string (possibly Unicode)
Optionally takes 3 keyword arguments to use caching supplied by Buffet.
Example:
>>> content = render('/my/template.myt')
>>> print content
>>> content = render('/my/template.myt', fragment=True)
Note
Not all template languages support the concept of a fragment. In those template languages that do support the fragment option, this usually implies that the template will be rendered without extending or inheriting any site skin.
Returns the rendered response within a Response object
See render for information on rendering.
Example:
def view(self):
return render_response('/my/template.myt')
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.
This class contains 3 members.
Myghty Template Plugin
This Myghty Template Plugin varies from the official BuffetMyghty in that it will properly populate all the default Myghty variables needed and render fragments.
This class contains 4 members.
See the source for more information.