On Thu, Feb 24, 2011 at 9:13 PM, AwaisMuzaffar <awais1...@googlemail.com> wrote: > > Lets assume, I have the following route set up: > > config.add_route('pages', '/{page}/', view='testproject:views.pages', > view_renderer='testproject:templates/page.mak') > > Would it be possible to make the template name e.g page.mak a variable > that matches the name of the response path. > > something like: view_renderer = .. templates/{page}.mak > > So template name uses the path name. > > I hope you guys understand what I am getting at.
You can leave out 'view_renderer' here and return a rendered template from your view instead. Your view function could then look like this: def pages(request): name = request.matchdict['page'] return render_to_response('templates/%s.pt' % name, request=request) See http://docs.pylonsproject.org/projects/pyramid/dev/narr/templates.html -- Daniel Nouri http://danielnouri.org -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.