ANN: CherryTemplate-1.0.0 released

Remi Delon remi at
Thu Nov 18 19:31:08 CET 2004

Hello everyone,

I'm happy to announce the first release of CherryTemplate, an easy and
powerful templating system in python.

Note that it is not "yet another templating system" because it used to
be part of CherryPy, but is now released as a standalone package.

Basically, you use it like this:

$ python
Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from cherrytemplate import renderTemplate
>>> name = "world"
>>> renderTemplate('Hello, <py-eval="name"/>')
'Hello, world'

The language only has a few tags: py-eval, py-exec, py-code, py-if,
py-for, py-include but it is quite powerful because most of python's
power is still available from the template:
    - "py-for" allows you to do things like <py-for="i,j in [(0,0),
(1,2), (3,1)]">
    - "py-code" allows you to insert full blocks of pure python code
inside your template (it takes care of the indentation for you)

CherryTemplate can also render external templates (ex:
renderTemplate(file = 'template.html')) and has full unicode support.

Once nice feature about it is that is uses generators to render your
template, so if you need to process a large amount of data you can
tell it to return a generator, and then you can loop through it. This
way it doesn't use up too much memory. Here is an example:

>>> template = '''<py-for="i in
>>> result = renderTemplate(template, returnGenerator = True)
>>> for res in result: print repr(res)

You can find more information (including the download link) on this


More information about the Python-announce-list mailing list