malthe / chameleon

Fast HTML/XML template engine for Python
https://chameleon.readthedocs.io
Other
176 stars 64 forks source link

python: expressions containing line-breaks not handled properly #100

Closed zopyx closed 11 years ago

zopyx commented 12 years ago

A ZPT containing

11 tal:replace="structure python: scale.scale('image', 12 width=250, height=250, direction='down').tag()" />

causes

Module chameleon.template, line 189, in render Module chameleon.template, line 175, in render Module 35965522f28e842ee01e1c56b5b1d7bf0930b199.py, line 415, in render Module 621939ba8b9d39114735561e508d6c245122ed1c.py, line 1974, in render_master Module 621939ba8b9d39114735561e508d6c245122ed1c.py, line 789, in render_content Module 35965522f28e842ee01e1c56b5b1d7bf0930b199.py, line 181, in __fill_content_core ExpressionError: invalid syntax

                                           width=250, height=250, direction='down').tag()"

This behavior is odd since it is allowed in the standard ZPT implementation and especially because line-breaks in over-long python expressions improve the readability.

malthe commented 12 years ago

I wonder if this is a problem specific to five.pt because the Python-expression in Chameleon itself seems to handle newlines just fine: 661eb98461c04171fb35386f02d76bfd6e15b465.

zopyx commented 12 years ago

Possibly related to five.ft...since the error occured just after adding five.pt to my buildout

malthe commented 12 years ago

I really can't reproduce this issue.