Skip to content

Instantly share code, notes, and snippets.

@n8agrin
Created September 11, 2009 00:04
Show Gist options
  • Save n8agrin/184934 to your computer and use it in GitHub Desktop.
Save n8agrin/184934 to your computer and use it in GitHub Desktop.
>>> t=tornado.template.Template('<html>{{ bar }}</html>')
>>> t.generate()
ERROR:root:<string> code:
1 def _execute():
2 _buffer = []
3 _buffer.append('<html>')
4 _tmp = bar
5 if isinstance(_tmp, str): _buffer.append(_tmp)
6 elif isinstance(_tmp, unicode): _buffer.append(_tmp.encode('utf-8'))
7 else: _buffer.append(str(_tmp))
8 _buffer.append('</html>')
9 return ''.join(_buffer)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tornado/template.py", line 127, in generate
return execute()
File "<string>", line 4, in _execute
NameError: global name 'bar' is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment