New submission from Adam Hutton <>:

I'm using Chameleon 1.1.1 and Pylons 0.9.7.

In this example, c.facility_housing is a list of objects (SQLAlchemy-created)
which have an attribute '.housing' that is a string.

>>> ', '.join([housing_type.housing for housing_type in c.facility_housing])
u'Assisted Living, Independent Living'

@@ Chameleon Page Template
<dd tal:content = "', '.join([housing_type.housing for housing_type in
c.facility_housing])" />

NameError: housing_type

@@ (note: I've never written a test before so apologies for any errors in the
Tack this onto one of the existing doc tests:

List Comprehension

An issue was observed where list comprehension notation resulted
in a NameError unless the iterator was already defined.

  >>> print render("""\
  ... <div xmlns="";
  ...      xmlns:tal="";>
  ...  <span tal:content="'-'.join([str(foo) for foo in range(6)])" />
  ... </div>""")
  <div xmlns="";>

messages: 387
nosy: adamhutton
priority: bug
status: unread
title: Chameleon does not understand Python list comprehension

Repoze Bugs <>
Repoze-dev mailing list

Reply via email to