New submission from Adam Hutton <ahut...@usnews.com>: 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. @@ PYTHON >>> ', '.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])" /> @@ ERROR NameError: housing_type @@FAILING TEST @@ (note: I've never written a test before so apologies for any errors in the test-writing) 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="http://www.w3.org/1999/xhtml" ... xmlns:tal="http://xml.zope.org/namespaces/tal"> ... <span tal:content="'-'.join([str(foo) for foo in range(6)])" /> ... </div>""") <div xmlns="http://www.w3.org/1999/xhtml"> <span>0-1-2-3-4-5</span> </div> ---------- messages: 387 nosy: adamhutton priority: bug status: unread title: Chameleon does not understand Python list comprehension __________________________________ Repoze Bugs <b...@bugs.repoze.org> <http://bugs.repoze.org/issue142> __________________________________ _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev