Skip to main content

Zope Page Template engine based on Chameleon

Project description

Overview
========

This package provides a fast Zope Page Template implementation based
on the Chameleon template compiler. It's largely compatible with
``zope.pagetemplate``.

Usage
-----

Load the package component configuration file (configure.zcml).

Performance
-----------

Casual benchmarks pegs it 16x more performant than the reference
implementations for Zope TAL and Genshi (using Python-expressions).

Compiler notes
--------------

The compiler is largely compatible with the reference
implementation. The TAL implementation is based on the 1.4 language
specification.

Some notable changes:

1. Tuple unpacking is allowed when defining variables:

tal:define="(a, b, c) [1, 2, 3]"

2. Generators are allowed in tal:repeat statements. Note that the
repeat variable is not available in this case.

tal:repeat="i <some generator>"

3. Attribute-access to dictionary entries is allowed in
Python-expressions, e.g.

dictionary.key

can be used instead of ``dictionary['key']``.

4. The default expression type is Python.

5. Genshi expression interpolation syntax is supported outside tags
and inside static attributes, e.g.

<span class="hello-world">Hello,{'world'}!
</span>


.. _TAL: http://wiki.zope.org/ZPT/TALSpecification14


Development
-----------

If you want to use the code directly from trunk (recommended only for
development and testing usage), provide ``chameleon.zpt==dev`` as your
dependency.

The code is maintained in a subversion repository::

svn://svn.repoze.org/svn/chameleon.zpt

Want to contribute? Join #zope3-dev on Freenode IRC.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page