Compiler fails when template starts with blank line

Bug #544279 reported by Roberto
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
web.py
New
Undecided
Unassigned

Bug Description

When the template file in http://webpy.appspot.com/ is saved with a blank line at the top, the template compiler fails.

This might be related to bug #372540 (resolved in 0.33).

% python web/template.py --compile templates

Traceback (most recent call last):
  File "web/template.py", line 1414, in <module>
    compile_templates(sys.argv[2])
  File "web/template.py", line 1074, in compile_templates
    t = Template(open(path).read(), path)
  File "web/template.py", line 834, in __init__
    code = self.compile_template(text, filename)
  File "web/template.py", line 892, in compile_template
    compiled_code = compile(code, filename, 'exec')
  File "templates/index.html", line 3
    def with (notes)
           ^
SyntaxError: invalid syntax

Template traceback:
    File 'templates/index.html', line 3
        <h1>Hello, world!</h1>

Roberto (fraile)
summary: - Blank lines at top of file breaks template compiler
+ Blank line at top of file breaks template compiler
summary: - Blank line at top of file breaks template compiler
+ Compiler fails when template starts with blank line
Revision history for this message
Karl Castle (karl-castle) wrote :

This is in the documentation, http://webpy.org/tutorial3.en#templating

"Currently, template.py requires the $def statement to be the first line of the file."

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.