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

What's wrong with this ZPT template?

I'm using Chameleon in a Python website I'm developing. Here's a snippet of code:
1
vote
2 answers

Chameleon ZPT templates

I have created a .pt template as that contains the following snippet ${password_confirm} My Problem is that the password_confirm field will not always be rendered by pyramid framework so it displays the error…
Madawar
  • 507
  • 1
  • 9
  • 26
1
vote
1 answer

template languages and ajax widgets

I have a really noob question about ajax widgets. It's really an extension of a question I asked a while ago: ajax widgets in pyramid and chameleon If you look at this question and the contents of the file account_login_widget.pt, you'll see the…
lostdorje
  • 6,150
  • 9
  • 44
  • 86
1
vote
1 answer

Trouble repeating elements using TAL, Chameleon and Pyramid

I'm really struggling to get TAL and Chameleon/Pyramid to play nice. . . I have a view in Pyramid that returns, for example, the following: def view(request): return {'results' : [ {'name':'alice', 'value':22}, …
Edwardr
  • 2,906
  • 3
  • 27
  • 30
1
vote
2 answers

Referencing a related object in Pyramids/Python/SQLAlchemy

I'm not sure how to title this question. I've also simplified my code so it's easier to ask. Say I have the following code in myproject.models in Pyramid: class Links(Base): __tablename__ = 'links' id = Column(Integer, primary_key=True) …
Jonathan Ong
  • 19,927
  • 17
  • 79
  • 118
1
vote
1 answer

Chameleon i18n and pluralization

How does pluralization in Chameleon templates? I didn't manage to find examples in the documentation. For, example could be having output 1 car and 2 cars
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
1
vote
1 answer

Display Text in Template?

I have a text field in my model that contains markdown text. I need to convert the text to html and show it in my .pt template. what is the best way to do it? I realise that I can add a method to my model that converts the field and returns HTML,…
akonsu
  • 28,824
  • 33
  • 119
  • 194
1
vote
1 answer

How can I have attributes that get extracted for i18n in ZPT macros?

I'm using Pyramid with ZPT templates to make a web app. I'm attempting to make a form template macro library to make life easier for things like setting current values of form fields, etc. I'm also using the lingua message extractors to…
David Roe
  • 1,228
  • 1
  • 11
  • 15
1
vote
1 answer

Using global names starting with "_" in Chameleon template engine

While upgrading chameleon template engine to version 2 , I've got errors like: NameError: global name '_c' is not defined where '_c' is used as a variable in template like: tal:content="_c(item['category']" in chameleon 1.2 everything was ok.…
Robert Zaremba
  • 8,081
  • 7
  • 47
  • 78
1
vote
1 answer

iOS Gradient color isse in collection view cell

I am facing this issue while setting gradient color to view inside the collection view When its plotted at first time its fine. but when I select some option and reload collection for the same it's happening like the second…
1
vote
1 answer

Pyramid / mongo : building a nested tal:repeat for a EmbeddedDocumentListField

i'm building a little app and testing at the same time Pyramid/Chameleon + MongoDB So far, I LOVE it but I've encountered a dead end Quick look a the data I want to display from a category collection _id:"category" themes:Array 0:Object …
ralberich
  • 31
  • 4
1
vote
1 answer

Set default value of inline substitution in Chameleon

Is there a way to set a default value for an ${}-style inline field in a Chameleon template so when it parse it does not die? >>> from chameleon import PageTemplate >>> template = PageTemplate("
Hello ${name}.
") >>> template() Traceback…
Matteo Ferla
  • 2,128
  • 1
  • 16
  • 27
1
vote
1 answer

tal nested dictionary syntax

Working with Pyramid, my code looks like this: class PageData: @staticmethod def create_data(): return [ { 'key_1A': 'info1A', 'key_2A': 'info2A', 'nested_list_A': [ …
Spiteless
  • 11
  • 3
1
vote
1 answer

BOOT_COMPLETED Broadcast Receiver Not Working in XOS-Android

I am working on an app that sends the updates to users weekly once, even if the app is not opened. For this i am using Alarm Manager to send push notification to user, but when device gets rebooted the alarm manager loose all data. For this i added…
1
vote
2 answers

TAL removes every TAG

I'm using Chameleon in the Pyramids Framework and TAL. Unfortunately TAL removes every tag up to the first both. HTML-Template: