Consolidate path retrieving from route

This commit is contained in:
Denis Makogon 2016-12-10 01:41:45 +02:00
parent 6f6a5e6f46
commit 560d7006ad
1 changed files with 4 additions and 3 deletions

View File

@ -93,13 +93,14 @@ class PublicRunnableV1Controller(controller.ServiceController,
description: Unable to execute private route description: Unable to execute private route
""" """
app = request.match_info.get('app') app = request.match_info.get('app')
path = request.match_info.get('route') path = "/{}".format(request.match_info.get('route'))
routes = await app_model.Routes.find_by(app_name=app, path=path) routes = await app_model.Routes.find_by(
app_name=app, path=path)
if not routes: if not routes:
return web.json_response(data={ return web.json_response(data={
"error": { "error": {
"message": "Route {0} not found".format(app), "message": "Route {0} not found".format(path),
} }
}, status=404) }, status=404)
route = routes.pop() route = routes.pop()