Skip to content

Commit

Permalink
add flask routes to named_routes
Browse files Browse the repository at this point in the history
  • Loading branch information
tino097 committed Oct 10, 2017
1 parent eb04958 commit babd73e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ckan/config/middleware/flask_app.py
Expand Up @@ -155,6 +155,21 @@ def hello_world_post():
if hasattr(plugin, 'get_blueprint'):
app.register_extension_blueprint(plugin.get_blueprint())

# Set flask routes in named_routes
for rule in app.url_map.iter_rules():
if '.' not in rule.endpoint:
continue
controller, action = rule.endpoint.split('.')
route = {
rule.endpoint: {
'action': action,
'controller': controller,
'highlight_actions': action,
'needed': list(rule.arguments)
}
}
config['routes.named_routes'].update(route)

# Start other middleware
for plugin in PluginImplementations(IMiddleware):
app = plugin.make_middleware(app, config)
Expand Down

0 comments on commit babd73e

Please sign in to comment.