Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install chameleon.zpt

How to install chameleon.zpt

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install chameleon.zpt
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.1.3 Available View build log
Windows (64-bit)
1.1.3 Available View build log
Mac OS X (10.5+)
1.1.3 Available View build log
Linux (32-bit)
1.1.3 Available View build log
Linux (64-bit)
1.1.3 Available View build log
 
Links
License
BSD
Depended by
Lastest release
version 1.1.3 on Jan 5th, 2011

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:

    System Message: WARNING/2 (<string>, line 30)

    Literal block expected; none found.

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:

System Message: WARNING/2 (<string>, line 35)

Literal block expected; none found.

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'].

  1. 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'}">

System Message: ERROR/3 (<string>, line 50)

Inconsistent literal block quoting.

Hello, ${'world'}! </span>

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:

System Message: WARNING/2 (<string>, line 65)

Literal block expected; none found.

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

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

Changelog

1.1.3 (released 04/11/2009)
  • Pull in Chameleon egg as dependency; the package has been

System Message: WARNING/2 (<string>, line 78)

Bullet list ends without a blank line; unexpected unindent.

merged.

1.1.2 (released 27/10/2009)

Bugfix:

  • Fixed import: expression issue where import expressions (dotted

System Message: WARNING/2 (<string>, line 86)

Bullet list ends without a blank line; unexpected unindent.

names) would allow invalid characters.

  • Fixed minor issue where the tail of a stray i18n:name-element would

System Message: WARNING/2 (<string>, line 89)

Bullet list ends without a blank line; unexpected unindent.

not get printed.

1.1.1 (released 08/10/2009)
  • Add support for an import: expression translator which resolves

System Message: WARNING/2 (<string>, line 95)

Bullet list ends without a blank line; unexpected unindent.

a Zope-style Python dotted name to a module global. Ex: <span tal:define="model_url import:repoze.bfg.url.model_url"/>. As a result, chameleon.zpt now depends on zope.dottedname. [chrism]

  • Add support for text templates to the template loader. [wichert]
  • Restore the parser ordered parameter for the Template and

System Message: WARNING/2 (<string>, line 102)

Bullet list ends without a blank line; unexpected unindent.

TemplateFile classes. This brings the calling convention in line with chameleon.core and makes the template loader work again. [wichert]

1.1 (released 23/09/2009)
  • Add support for text templates. [wichert]
1.0.0 (released 06/07/2009)
  • Insert an empty string in place for None with tal:content

System Message: WARNING/2 (<string>, line 114)

Bullet list ends without a blank line; unexpected unindent.

(LP #379769).

  • Include changelog in long description. [hannosch]
1.0b17 (released 20/05/2009)
  • Fixed whitespace issue. [malthe]
  • Update to latest Chameleon. [malthe]
1.0b16 (released 22/04/2009)
  • Raise syntax error during validation if metal:use-macro is used

System Message: WARNING/2 (<string>, line 129)

Bullet list ends without a blank line; unexpected unindent.

together with metal:define-macro. [malthe]

  • Add support for metal:extend-macro. [sidnei, malthe]
1.0b15 (released 17/04/2009)
  • Pass all keyword arguments to template superclass constructor. [malthe]
  • Define macros as a transient symbol; this fixes an issue where

System Message: WARNING/2 (<string>, line 139)

Bullet list ends without a blank line; unexpected unindent.

the render_macro method would not honor a macros parameter that was passed in. [malthe]

1.0b14 (released 08/04/2009)
  • Set template and macros symbols only if not explicitly

System Message: WARNING/2 (<string>, line 146)

Bullet list ends without a blank line; unexpected unindent.

passed to the template. [malthe]

  • Reverted to have template being the currently-being-executed

System Message: WARNING/2 (<string>, line 149)

Bullet list ends without a blank line; unexpected unindent.

template, and have a macros which refers to the macros from the source template instance. To refer to macros in the current template macros.<<name>> should be used. [sidnei]

1.0b13 (released 01/04/2009)
  • Added built-in name template, which refers to the template

System Message: WARNING/2 (<string>, line 157)

Bullet list ends without a blank line; unexpected unindent.

instance. This symbol is introduced to make it possible to refer to macros within the current template (e.g. template.macros.<name>). [malthe]

1.0b12 (released 31/03/2009)
  • Updated language adapter to work with 'structure' meta attribute.
  • Providing dynamic attributes on a TAL-element should fail. See LP

System Message: WARNING/2 (<string>, line 167)

Bullet list ends without a blank line; unexpected unindent.

#340078. [malthe]

1.0b11 (released 05/03/2009)
  • Fixed bug where whitespace would prevent matching. [malthe]
  • Added parser option to disable interpolation escaping. [malthe]
  • Enable DEBUG_MODE while running the tests. Some tests expect it to

System Message: WARNING/2 (<string>, line 177)

Bullet list ends without a blank line; unexpected unindent.

be enabled. [sidnei]

1.0b10 (released 22/02/2009)
  • Expressions inside variable substitutions are now escaped by

System Message: WARNING/2 (<string>, line 183)

Bullet list ends without a blank line; unexpected unindent.

default, unless the result is an object that has a __html__ method. [malthe]

  • When filling a macro slot, replace the entire element, rather than

System Message: WARNING/2 (<string>, line 187)

Bullet list ends without a blank line; unexpected unindent.

filling its contents. [malthe]

1.0b9 (released 29/01/2009)
  • Do not depend on component configuration; instead, fall back to a

System Message: WARNING/2 (<string>, line 193)

Bullet list ends without a blank line; unexpected unindent.

default "registry", modelled as a simple Python dictionary. [malthe]

  • Depend on utility and adapter directives from

System Message: WARNING/2 (<string>, line 196)

Bullet list ends without a blank line; unexpected unindent.

repoze.zcml rather than using "stock" utility and adapter directives from zope.component. This prevents chameleon.zpt from requiring zope.security (and thus zope.location, zope.publisher, and zope.traversing). [chrism]

1.0b8 (released 12/18/2008)
  • Added support for recursive expression translators. [malthe]
1.0b7 (released 12/17/2008)
  • Right-strip escape character from string-expressions (the semicolon

System Message: WARNING/2 (<string>, line 211)

Bullet list ends without a blank line; unexpected unindent.

';' character). [malthe]

1.0b6 (released 12/03/2008)
  • Added a interpolation meta attribute to control $-interpolation

System Message: WARNING/2 (<string>, line 217)

Bullet list ends without a blank line; unexpected unindent.

of expressions. This defaults to true for chameleon.zpt. [seletz]

1.0b5 (released 11/29/2008)
  • Removed unused imports, thanks to PyFlakes. [hannosch]
  • Updated handling of static attributes. [malthe]
1.0b4 (released 11/19/2008)
  • Allow empty expressions; for string-expressions, this means an

System Message: WARNING/2 (<string>, line 231)

Bullet list ends without a blank line; unexpected unindent.

empty string, rather than no expression. [malthe]

  • Fixed string escape issue. [malthe]
  • Fixed issue where translation pragma would be reset if a

System Message: WARNING/2 (<string>, line 236)

Bullet list ends without a blank line; unexpected unindent.

non-matching pragma was found. [malthe]

  • Fixed bug that would parse global defines incorrectly. [malthe]
  • TAL- and METAL-elements now subclass the XHTML-element class; this

System Message: WARNING/2 (<string>, line 241)

Bullet list ends without a blank line; unexpected unindent.

allows mixed usage of TAL and METAL. [malthe]

  • validate-method is no longer formally required; errors are

System Message: WARNING/2 (<string>, line 244)

Bullet list ends without a blank line; unexpected unindent.

expected to be raised by the translate-method. [malthe]

  • Formalized character escape requirement; this allows compatibility

System Message: WARNING/2 (<string>, line 247)

Bullet list ends without a blank line; unexpected unindent.

with ZPT with regards to semi-colon escapes in attribute declarations. [malthe]

  • Allow chained pragmas. [malthe]
1.0b3 (released 11/12/2008)
  • Added default element to parser class. [malthe]
1.0b2 (released 10/28/2008)
  • Fixed missing attribute. [malthe]
1.0b1 (released 10/14/2008)
  • Tags are now omitted if a "tal:content" expression evaluates to

System Message: WARNING/2 (<string>, line 266)

Bullet list ends without a blank line; unexpected unindent.

None. This behavior differs from the reference implementation, but does away with the need for a similar "tal:condition" attribute. [malthe]

1.0a2 (released 10/2/2008)
  • Add a specialized TemplateLoader. [wichert]
  • Fixed an incompatibility where non-boolean values would be returned

System Message: WARNING/2 (<string>, line 276)

Bullet list ends without a blank line; unexpected unindent.

as a skip node value. [malthe]

1.0a1 (released 9/24/2008)
  • First release.

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:2

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.