malthe/chameleon — Issue #98: Unhelpful error message with unquoted HTML attributes
Author: xiaq
Created: 2012-02-26 04:16:08+00:00
State: open

Minimal case:

```
>>> from chameleon import PageTemplate
>>> PageTemplate('''

''')()
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/zpt/template.py", line 163, in __init__
super(PageTemplate, self).__init__(body, **config)
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/template.py", line 120, in __init__
self.write(body)
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/template.py", line 207, in write
self.cook(body)
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/template.py", line 150, in cook
program = self._cook(body, digest, names)
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/template.py", line 217, in _cook
source = self._make(body, builtins)
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/template.py", line 248, in _make
program = self.parse(body)
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/zpt/template.py", line 202, in parse
trim_attribute_space=self.trim_attribute_space,
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/zpt/program.py", line 141, in __init__
super(MacroProgram, self).__init__(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/program.py", line 31, in __init__
for kind, args in parser:
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/parser.py", line 182, in __iter__
item = self.parse(token)
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/parser.py", line 190, in parse
return visitor(kind, token)
File "/usr/lib/python2.7/site-packages/Chameleon-2.7.3-py2.7.egg/chameleon/parser.py", line 227, in visit_end_tag
raise ParseError("Unexpected end tag.", token)
chameleon.exc.ParseError: Unexpected end tag.

- String: "

"
- Filename:
```

However the following doesn't cause any trouble:

```
>>> PageTemplate('''

''')()
u'

Hi

'
```

Seems it only happens when some unquoted HTML attribute **precede** a `tal:` attribute.