quote & apostrophe chars inside comments in python blocks

Issue #23 resolved
Anonymous created an issue

A simple template file:


  1. it's a comment %>

will raise a Syntax exception, because of the apostrophe character in the comment text. The same happens if there is a quotation mark.

-style comments outside python blocks are not affected.


Traceback (most recent call last): File "wsgiref/handlers.py", line 92, in run File "/usr/local/myapp/lib/myapp/wsgiapp.py", line 85, in application template = templatelookup.get_template(templateuri) File "/usr/local/myapp/lib/mako/lookup.py", line 60, in get_template return self.check(uri, self.collection[uri]) File "/usr/local/myapp/lib/mako/lookup.py", line 126, in check return self.load(template.filename, uri) File "/usr/local/myapp/lib/mako/lookup.py", line 110, in load self.collection[uri] = Template(uri=uri, filename=posixpath.normpath(filename), lookup=self, module_filename=(self.modulename_callable is not None and self.modulename_callable(filename, uri) or None), self.template_args) File "/usr/local/myapp/lib/mako/template.py", line 68, in init _compile_module_file(self, file(filename).read(), filename, path) File "/usr/local/myapp/lib/mako/template.py", line 186, in _compile_module_file node = Lexer(text, filename, input_encoding=template.input_encoding, preprocessor=template.preprocessor).parse() File "/usr/local/myapp/lib/mako/lexer.py", line 139, in parse if self.match_python_block(): File "/usr/local/myapp/lib/mako/lexer.py", line 251, in match_python_block (text, end) = self.parse_until_text(r'%>') File "/usr/local/myapp/lib/mako/lexer.py", line 66, in parse_until_text raise exceptions.SyntaxException("Unmatched '%s'" % match.group(1), self.matched_lineno, self.matched_charpos, self.filename) SyntaxException: Unmatched ''' in file '/usr/local/myapp/templates/bug.html' at line: 3 char: 5

Comments (1)

  1. Log in to comment