....
{{ trim_string('a string that is too long............')}}
....
2。pass the function in as a template variable
template_vars['mesage']='hello'
template_vars['function']= my_function # Note: No ()
self.render('home.html',**template_vars
)
Then in your template you call it like this:
{% my_function('some string')%}
3。import functions in Tornado. I think this is the cleanest solution. At the top of your template simply do the following: