Is there something wrong with the alias for render_string of templates? #883

junewu opened this Issue Aug 19, 2013 · 1 comment


None yet
2 participants

junewu commented Aug 19, 2013

Why does tornado.escape.xhtml_escape have two different aliases? (See Templates)

Expressions can be any Python expression, including function calls. Template code is executed in a namespace that includes the following objects and functions (Note that this list applies to templates rendered using RequestHandler.render and render_string. If you're using the template module directly outside of a RequestHandler many of these entries are not present).

escape: alias for tornado.escape.xhtml_escape
xhtml_escape: alias for tornado.escape.xhtml_escape


bdarnell commented Aug 20, 2013

This is intentional. It has the short name "escape" because it's such a common operation (or at least it was before the introduction of auto-escaping in Tornado 2.0), and it's also available as "xhtml_escape" because that's what it's called in python code.

bdarnell closed this Aug 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment