Permalink
Browse files

Added a template filter decorator to blueprints.

  • Loading branch information...
1 parent 8532bd5 commit 2a4d3ef1168e0ea1733898527229961c9ddafced @Reisen Reisen committed with rduplain Jul 8, 2011
Showing with 11 additions and 0 deletions.
  1. +11 −0 flask/blueprints.py
View
@@ -185,6 +185,17 @@ def register_endpoint(state):
return f
return decorator
+ def app_template_filter(self, name = None):
+ """Like :meth:`Flask.template_filter` but for a blueprint. The filter
+ is available for the entire application.
+ """
+ def decorator(f):
+ def register_template(state):
+ state.app.jinja_env.filters[name or f.__name__] = f
+ self.record_once(register_template)
+ return f
+ return decorator
+
def before_request(self, f):
"""Like :meth:`Flask.before_request` but for a blueprint. This function
is only executed before each request that is handled by a function of

0 comments on commit 2a4d3ef

Please sign in to comment.