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
1
vote
1 answer

chameleon add line to fill-slot

i have a website with a dynamic number of widgets, the pyramid view(views.py) call the page, and send the data: View.py: @view_config(route_name='home', renderer='templates/home.pt') def home_view(request): widgets = #do sql stuff# return…
Joaolvcm
  • 1,983
  • 3
  • 20
  • 24
1
vote
2 answers

Chameleon template looping

I tried to create template using chameleon. Here is a code snipet. Calling module runtemp.py: delete_list=[] delete={'Name':'aaa','Sirname':'bbb','Friends':['ccc','ddd','eee']} delete_list.append(delete) templates =…
Nikhil Rupanawar
  • 4,061
  • 10
  • 35
  • 51
1
vote
1 answer

How to use internationalization in chameleon with pyramid web framework?

I have done the following: Change pyramid.default_locale_name = en to de in development.ini My index.pt looks like this:
Ranjith Ramachandra
  • 10,399
  • 14
  • 59
  • 96
1
vote
1 answer

Chameleon macros without Pyramid

Here's some code I use in Pyramid to load macros into my Chameleon templates: @subscriber(BeforeRender) def add_base_templates(event): """Define the base templates.""" main_template =…
Theron Luhn
  • 3,974
  • 4
  • 37
  • 49
0
votes
1 answer

I am having issues with installing Chameleon and jinja2 with python3

I have decided to use python 3 in a project. When I tried easy_install pyramid, one of the things that came with pyramid (namely Chameleon) threw a syntax error. I decided to use Pyramid_Jinja2 instead and tried easy_install Jinja2 and I got a few…
Ranjith Ramachandra
  • 10,399
  • 14
  • 59
  • 96
0
votes
1 answer

Compatible versions for python and chameleon

I want to know the proper Chameleon version for python 2.6. Also want to know a table structure like which version actually suits which version of Chameleon.
janu
  • 61
  • 1
  • 3
0
votes
1 answer

Any detailed documentation about the Chameleon Template in Pyramid Web Framework?

There's only a brief introduction to Chameleon Template in document of pyramid. Any detailed documentation/tutorial ?
Determinant
  • 3,886
  • 7
  • 31
  • 47
0
votes
0 answers

Location of Page Template object from inside a macro

Is there a way to get the object in which a defined macro is located? I know that in a Zope Page Template, I have access to the "template" variable, which always points to the Page Template that was called in the first place. This variable can even…
Georg Pfolz
  • 1,416
  • 2
  • 12
  • 12
0
votes
1 answer

Telling Zope/Chameleon to not parse a section?

I have a Pyramid app that uses Chameleon. I need to declare some attributes in my DOCTYPE, like so: ]> When I add this to my template, id doesn't get rendered properly…
Aviv
  • 75
  • 7
0
votes
1 answer

Python Paste script crashes with big template file?

I have a Pyramid application that uses Chameleon as its template engine. I have one (quite large, but I have had larger) template that will just not work. Whenever I try to render it to return as a view, paste server development.ini crashes…
Aviv
  • 75
  • 7
0
votes
1 answer

Loading Macros from Other Template Files in Chameleon

I have a Pyramid app that uses Chameleon for its templates. I would like to create a master template page (say master.pt) that contains several macros that I user throughout the pages of my site. I am trying to load these macros in different…
Aviv
  • 75
  • 7
0
votes
2 answers

use Chameleon ZPT templates to write out print statements

I am using Pyramid and I know that this is probably not the preferred way to do things but it would be really cool. I have a bunch of Python scripts which print to stdout. Now I want to run these scripts as part of a request/ response in Pyramid. I…
moin moin
  • 2,263
  • 5
  • 32
  • 51
0
votes
2 answers

configuring repoze.bfg to use utf-8 encoding

I'm using repoze.bfg v1.3 and chameleon v2 (zpt templates). I got troubles with encoding while rendering template: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 9: ordinal not in range(128) How can i configure repoze.bfg to…
Robert Zaremba
  • 8,081
  • 7
  • 47
  • 78
0
votes
2 answers

How do I call a cache busting function inside request.static_url() in my layout.pt chameleon template

I'm using a Cookiecutter Pyramid web development framework. This has three linked files: utils.py - defines the random cache string to add to an url views.py - passes utils functions to chameleon template layout.pt - chameleon template calling…
thunt
  • 89
  • 1
  • 11
0
votes
1 answer

Chameleon/TAL/ZPT template problem in tal:repeat

I am trying to use Chameleon Template for Python (it's based on Zope TAL/METAL language). This simple template raises error (dic is dictionary in the list):
RandomB
  • 3,367
  • 19
  • 30