'Register a custom template filter.  Works exactly like the
:meth:`template_filter` decorator.
:param name: the optional name of the filter, otherwise the
function name will be used.'

@setupmethod
def add_template_filter(self, f, name=None):

    self.jinja_env.filters[(name or f.__name__)] = f
