Chameleon template engine for Python

Subscribe to our

Web templating is a way to represent data in different forms. Templates allow presenting a large amount of content on similar-looking pages or applying some data source to customize the pages. They are a tool provided for content management systems, web application frameworks, and HTML editors.

Templating modules are designed to generate the document output of a web application, typically HTML markup or XML. There is a big number of various HTML/XML templating packages and modules written in Python. It is quite easy to develop template engine mechanisms using flexible Python code, so each package comes with different feature sets and syntaxes.

Chameleon is an HTML/XML template engine for Python. It is a fast page template implementation which compiles markup templates into Python byte-code. This engine is optimized for speed and robust performance. Python is the default expression language (instead of path expressions). Chameleon is the default template engine for the Pyramid framework. It is also often used with Zope, Django, Plone and Grok projects.

A set of simple language constructs are the main part of the page templates language. They will be placed within your document structure as special element attributes and text markup. Chameleon uses them to control the document structure, element repetition, text replacement and translation. The language used is Chameleon page templates is originally a Zope invention. In this engine it is packaged as a standalone distribution that can be used in any script or application running Python 2.5 and up. It comes with a rich set of expression types and language features.

Chameleon provides support for two different types of templates: ZPT template and text template. ZPT templates are applied to render markup with a dictionary set of key/value parameters provided by a manufactured response, while text page templates use a response string with no markup. As an attribute language template compiler, Chameleon supports both the ZPT and Genshi templating specifications.

For more information visit Chameleon documentation.

Follow