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
3
votes
3 answers

How to set multiple values for the same attribute in tal:attributes using TALES

I'm trying to set multiple css classes on one element. Unfortunately this doesn't work, as it returns: LanguageError: Duplicate attribute name in attributes.
3
votes
0 answers

PyCharm gutter navigation icons

Hi I was wondering if someone could point me in the right direction. I have a number of existing pyramid projects which I have used the "open directory" option in PyCharm 5 to access. This creates a "project" entry in PyCharm project manger, but I…
Mr-F
  • 871
  • 7
  • 12
3
votes
1 answer

Can I nest multiple template objects inside another chameleon template?

Say I had a chameleon template file for a user object with something like this:

Can I loop over a list of users in another template file to…
c0lon
  • 210
  • 1
  • 9
3
votes
0 answers

How do I integrate Chameleon with Flask?

I know jinja2 is the default built-in template engine for Flask. My question is: Is it possible to integreate Chameleon with Flask ? If so, how can I do that ? This is how I did. I wrap the response string in a method.. from chameleon import…
Khanh Hua
  • 1,086
  • 1
  • 14
  • 22
3
votes
2 answers

How do you place a Bokeh chart within a Chameleon template?

I have a project with many scripts using Matplotlib. I'd like to build a web interface for this project. How do you place a Bokeh chart within a Chameleon template? I'm using Pyramid and the Deform bootstrap if that matters. Does anyone have a…
EnergyGeek
  • 271
  • 1
  • 4
  • 14
3
votes
2 answers

Configurable head with chameleon load

When using chameleon, I can replace element from a base template using the concept of slot. Where you define a slot and fill it using another tag. As there is no container element in head, how can one add elements to head ? : The Layout…
3
votes
1 answer

how to use macros with pyramid / ZPT (Chameleon)

I want to use macros with pyramid+ZPT engine (Chameleon). The docs say that "A single Page Template can accommodate multiple macros." http://chameleon.readthedocs.org/en/latest/reference.html#macros-metal Thus I defined a file macros.pt:
Knut
  • 431
  • 4
  • 14
3
votes
1 answer

How do I test Pyramid Chameleon Templates?

I know how to unit test my views using something like this: class ViewsTests(unittest.TestCase): def setUp(self): request = DummyRequest() self.config = setUp(request=request) def tearUp(self): tearUp() def…
Matt234
  • 1,055
  • 8
  • 14
3
votes
2 answers

Line Breaking in Chameleon

I have used the pyramid framework to build a large web application. Among other things, this application allows the user to enter text into a text area form field. This text is then saved to a database and of course can be readout again and…
Meneldur
  • 215
  • 1
  • 5
3
votes
2 answers

Rendering nested elements with an arbitrary depth using Chameleon ZPT

I am using Pyramid framework and I would like to render with Chameleon a html menu with nested lists (ul, li) of an arbitrary depth. I cannot find some sort of recursive method in Chameleon in order to do so. It seems such a common need so I am…
user1919510
3
votes
1 answer

How do you specify the html5 doctype with Python Chameleon?

I've thoroughly RTFMed and Googled for this, and I can't seem to find the answer. I am new to Chameleon, so maybe it's just so obvious that it's no where to be found, but when I put in my master template, the rendered page has it…
Jesse Kochis
  • 766
  • 3
  • 10
3
votes
2 answers

ParseError: Unexpected end tag - How to clean html tags?

I'm starting to learn web development and am using pyramid with chameleon. I just took some sites html source as a template in Dreamweaver and then copied the code into a chameleon .pt file. The html code displays fine in dreamweaver but I get this…
Lostsoul
  • 25,013
  • 48
  • 144
  • 239
2
votes
1 answer

POT file with tags instead of

I'm trying to translate text out of a template file in a Pyramid project. More or less as in this example: http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/chameleon_i18n.html Now how do I get rid of the in the…
lukas
  • 183
  • 1
  • 1
  • 10
2
votes
1 answer

Inject rendered content from several views in Pyramid into one base template

I'd like to do something like below. I have the following routes configured: config.add_route('home', '/') config.add_route('foo', '/foo') The following views: @view_config(route_name='home', renderer='templates/home.pt') def home_view(request): …
rtn
  • 127,556
  • 20
  • 111
  • 121
2
votes
1 answer

Can chameleon support block caching?

I'm evaluating chameleon as a template renderer for Pyramid. Some feature quite useful from Django, which also works with mako, is caching. I couldn't find a similar feature by looking at the documentation, neither with a quick google search. Is…
ascobol
  • 7,554
  • 7
  • 49
  • 70