Skip to content

Commit

Permalink
Give template-generated code a fake "filename" to avoid confusing cod…
Browse files Browse the repository at this point in the history
…e-coverage tools
  • Loading branch information
bdarnell committed Jun 11, 2011
1 parent 696d978 commit 482ccef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tornado/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def __init__(self, template_string, name="<string>", loader=None,
self.file = _File(_parse(reader, self))
self.code = self._generate_python(loader, compress_whitespace)
try:
self.compiled = compile(self.code, self.name, "exec")
self.compiled = compile(self.code, "<template %s>" % self.name,
"exec")
except:
formatted_code = _format_code(self.code).rstrip()
logging.error("%s code:\n%s", self.name, formatted_code)
Expand Down

0 comments on commit 482ccef

Please sign in to comment.