Questions tagged [chameleon]

Chameleon is an open-source template engine written in Python. It implements both the Zope Pagetemplate specification (TAL and TALES) and a plain text format.

Chameleon is an open-source XML/HTML template engine written in .

It’s designed to generate the document output of a web application, typically HTML markup or XML.

The language used is , originally a invention (see ), but available here as a standalone library that you can use in any script or application running Python 2.5 and up (including 3.x and pypy). It comes with a set of new features, too.

The template engine compiles templates into Python byte-code and is optimized for speed. For a complex template language, the performance is very good.

Features

  • Fast — templates are compiled to byte-code.
  • Extensible — it's easy to extend a language or create your own!
  • Tested — automated tests guard against regressions.

Official website: http://chameleon.repoze.org/

Tag use

When asking questions about the template language, consider adding (TAL constructs) and / or (METAL macro constructs) as well.

118 questions
2
votes
2 answers

Chameleon Templating: Default value in 'tal:switch'

I am trying to build a switch/case structure around a range of integer values. As stated in the language reference, if the case expression is the symbol default, it always matches the switch. However, I am looking for a symbol that matches in all…
Fynn
  • 4,753
  • 3
  • 32
  • 69
2
votes
1 answer

Pyramid and Chameleon ZPT Repetition

I am trying to loop through a list and get an output like this: Python: items=['item1', 'item2', 'item3'] return dict(items=items) HTML:
2
votes
1 answer

Pyramid i18n and HTML5

Does Pyramid i18n of .pt files support HTML5 mark-up? Currently the i18n tag extractor (Babel?) seems to want XHTML based input and does not accept HTML5 mark-up. Thus if you want to use i18n in .pt files you are forced to write them in XML'ish way?
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
2
votes
1 answer

Nested list with TAL

I'm using Chameleon in the Pyramids Framework and want to repeat nested list while rendering the template. My minimized HTML-Code is: 1.
    2.
  • 3. 4. …
Tobias S
  • 1,275
  • 8
  • 23
2
votes
1 answer

How to include another template with Chameleon?

I'm using the latest Chameleon in latest Pyramid. Sometimes I want to let a template include another template. With PHP, I may use such as '@include('_partials.assets')', but how to use with Chameleon? In the question How to use template inheritance…
qingkejin
  • 799
  • 1
  • 5
  • 9
2
votes
1 answer

Dependent/Cascading inputs using Deform

I'm trying to do a series of dependent inputs with Deform / Colander / Chameleon / Pyramid and can't find any examples. e.g. Dropdown of Country yields-> Dropdown of State or Province or Division ..etc.. yields-> Dropdown of County or City ... might…
Still.Tony
  • 1,437
  • 12
  • 35
2
votes
1 answer

Pyramid ignore missing template variables

I have a simple form using Pyramid and I want to use it as a new or update. I don't particularly want to have to create empty dictionary values for all the fields in my form, I just want it to ignore them without raising an exception.
Neil Walker
  • 6,400
  • 14
  • 57
  • 86
2
votes
2 answers

How to use tal variable with javascript?

I want to pass a variable returned as a response to the zope template into a javascript variable in pyramid. here's the views code : def return_table(request): selected = request.params.getall("selectedcategories") return {'selected':…
Mudits
  • 1,513
  • 3
  • 20
  • 37
2
votes
2 answers

Pyramid Chameleon template security for HTML and Javascript

Do Chameleon templates escape/strip XSS and HTML tags for variables? Would the following be safe?