Create a gist now

Instantly share code, notes, and snippets.

Traceback (most recent call last):
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/", line 1021, in _stack_context_handle_exception
raise_exc_info((type, value, traceback))
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/", line 258, in _nested
yield vars
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/", line 228, in wrapped
callback(*args, **kwargs)
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/", line 382, in inner
self.set_result(key, result)
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/", line 315, in set_result
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/", line 345, in run
yielded = self.gen.send(next)
File "/Users/DLC/Code/gkapps/b/handlers/", line 135, in get
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/", line 500, in render
html = self.render_string(template_name, **kwargs)
File "/Users/DLC/Code/gkapps/handlers/", line 13, in render_string
return tornado.web.RequestHandler.render_string(self, template, **kwargs)
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/", line 607, in render_string
return t.generate(**namespace)
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/", line 261, in generate
return execute()
File "web/", line 429, in _execute
return _utf8('').join(_buffer) # web/base.html:0
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 27: ordinal not in range(128)
#catch link and hashtags or @ mentions
_LINK_RE = re.compile(ur"([@#])([\w]+)")
def link_elements(text):
def make_link(m):
link_type =
if link_type == u'@':
link_type = u'/%s' %
link_type = u'/tag/%s' %
return u'<a href="%s">%s</a>' % (link_type,
return _LINK_RE.sub(make_link, text)
return self.render("t.html", link_elements=link_elements)
{% extends "base.html" %}
{% block body %}
{% if len(comments) > 0 and (not is_app or show_comments) %}
<div class="comments">
{% for comment in comments %}
<a class="username" href="/{{ comment["user"]["username"] }}">{{ comment["user"]["username"] }}</a>
<p class="comment">{% apply link_elements %}{{ comment['textContent'] }} {% end %}</p>
{% end %}
{% end %}
{% end %}
{% end %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment