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

Send AJAX Request and response with new URL

at first I want to say, that I'm new to web development and missing some specific scientific terms. I'm using Pyramids for the backend and Chameleon in the front end. Now I've a main page, where I send a few ajax request. After the response is…
Tobias S
  • 1,275
  • 8
  • 23
1
vote
0 answers

How to Create Tree in Chameleon Template Using TAL and Nested Set List (Modified Preorder Tree Traversal)

I'm using the nested set hierarchy, or modified preorder tree traversal (MPTT) algorithm, as described here, and I'm having a difficult time understanding how to translate the depth and category name into a Chameleon template to display a nested…
dhildreth
  • 637
  • 1
  • 6
  • 15
1
vote
1 answer

Tal condition string contains

Trying to change table data based on conditions. Stuff Stuff string.stringname may have -shadow at the very…
Jer_TX
  • 465
  • 4
  • 20
1
vote
1 answer

Listing pyramid template files from a view

I want to make some of my templates user editable inside my web app (the actual template, not just replacing content via replacement variables). But I can't figure out how to get a list of template files. Obviously if I know the real path I can…
Falmarri
  • 47,727
  • 41
  • 151
  • 191
1
vote
0 answers

generate html with translation

For a generic form checker I want to generate html fields plus internationalized error messages (and default values, ...) while using templates to define which fields are in the form. Template example: ...
${structure:…
Knut
  • 431
  • 4
  • 14
1
vote
1 answer

use JQuery jstree with python pyramid?

I am trying to use JQuery JsTree with Python Pyramid + Chameleon. All goes well except the definition of icons. My JSTree is loaded from a XML that I produce using Python, but when I try to set the icon with: contentName.attrib["icon"] =…
QLands
  • 2,424
  • 5
  • 30
  • 50
1
vote
2 answers

Pyramid Chameleon Tal:condition 'Not' issue

I am trying to display conditional text in a Pyramid Chameleon template. Basically, checking if the dictionary key 'maxed_out_alerts' is empty (false) or has a string 'yes' in it.

Maxed Out.

fat fantasma
  • 7,483
  • 15
  • 48
  • 66
1
vote
1 answer

z3c.form issue: ImportError: No module named ptcompat

Has z3c.form API changes recently. I try to do following: from z3c.form.ptcompat import ViewPageTemplateFile widget.template = ViewPageTemplateFile("templates/minmax.pt") I get: ImportError: No module named ptcompat How to fix?
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
1
vote
1 answer

dynamicly fill table using zpt and ajax as update

I'm creating a webproject in pyramid where I'd like to update a table every few secondes. I already decided to use ajax, but I'm stuck on something. On the client side I'm using the following code: function update() { var variable =…
GertV
  • 831
  • 2
  • 10
  • 23
1
vote
2 answers

Give each table a new id using zpt

I'm using the tal:repeat statement to generate tables inside another table. Sadly I do not know how to give each table an unique id when generated. How can I do this? I'm trying to use: tal:attributes="id myindex" and tal:attributes="id…
GertV
  • 831
  • 2
  • 10
  • 23
1
vote
1 answer

Selectively enabling Chameleon page templates on Plone

Reading https://pypi.python.org/pypi/five.pt/2.2.1 To enable Chameleon, configure the package using ZCML: Are Chameleon templates enabled per-package or globally? Instructions are little sparse. If I want to…
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
1
vote
1 answer

sql alchemy + pyramid, "request cache"

i'm making a website, using pyramid, sqlalchemy and chameleon... on the view.py i send the sqlalchemy: @view_config(route_name='entity_subpage') def entity_subpage_view(request): dbsession = DBSession() User =…
Joaolvcm
  • 1,983
  • 3
  • 20
  • 24
1
vote
3 answers

Mako Filter in Chameleon?

Is there any possibility to use template filters in Chameleon as I'm used to in Mako? In Mako one could do something like ${s | filter} where filter is a function mapping strings to strings and Mako applied filter to s and outputs it (after…
born
  • 656
  • 1
  • 6
  • 21
1
vote
0 answers

Missing Chameleon module in Pyramid Tutorial

I'm following the Pyramid tutoral. I've also gone through the setup without any errors reported here But I get this when attempting to run the app. File…
user2040800
  • 227
  • 4
  • 14
1
vote
1 answer

"while" loops in Chameleon?

I'm working on a Pyramid project and am considering something which will come later. My particular use case is ascending the resource tree to construct a breadcrumb, but I'm curious about the general implementation, too. In Python code, I'd be…
Chris Morgan
  • 86,207
  • 24
  • 208
  • 215