Skip to content

Commit

Permalink
[#3196] Make helper functions (h) available to Flask templates
Browse files Browse the repository at this point in the history
Tests incoming
  • Loading branch information
amercader committed Aug 16, 2016
1 parent 3f45530 commit 7c9ca60
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ckan/config/middleware/flask_app.py
Expand Up @@ -11,6 +11,7 @@
from werkzeug.exceptions import HTTPException
from werkzeug.routing import Rule

from ckan.lib import helpers
from ckan.common import config, g
import ckan.lib.app_globals as app_globals
from ckan.plugins import PluginImplementations
Expand Down Expand Up @@ -38,6 +39,12 @@ def make_flask_stack(conf, **app_conf):
app.config.update(app_conf)

# Template context processors
@app.context_processor
def helper_functions():
u'''Make helper functions (`h`) available to Flask templates'''
helpers.load_plugin_helpers()
return dict(h=helpers.helper_functions)

@app.context_processor
def c_object():
u'''
Expand Down

0 comments on commit 7c9ca60

Please sign in to comment.