I'm not sure if you can use contex=Root in this situation, but what you are asking for is perhaps a matchdict .
.
__ __ INIT ru:
config.add_route('serve_route', '/{project_name}/testruns/{testrun_name}/plots/{plot_name}.png')
views.py:
@view_config(route_name='serve_route') def plot_view(request): project_name = request.matchdict['project_name'] action = request.params.get('action', None)
http://docs.pylonsproject.org/projects/pyramid/1.1/narr/urldispatch.html#matchdict
Edit:
If your question is a more general question regarding routing, you should create one route for each action so that your view code is shorter and more understandable. For example, if you want to edit and visualize, your routes might look something like this:
.
__ __ INIT ru:
config.add_route('render_plot', '/{project_name}/testruns/{testrun_name}/plots/{plot_name}.png') config.add_route('edit_plot', '/{project_name}/testruns/{testrun_name}/plots/{plot_name}/edit')
views.py:
@view_config('render_plot') def render(request): pass @view_config('edit_plot', renderer='bunseki:templates/form.pt') def edit(request): pass
source share