Easy way to switch between renderers within the same view method
I set up my function like this @view_config( route_name = 'route_name', permissions = 'permissions', renderer = 'r.mako' ) def r( request ): # stuff goes here now, I want to add functionality such that I check certain conditions (using ajax) i would use one template, otherwise use another. is there a way to do this in pyramid? thanks Well you can add the view multiple times with different renderers if you can determine what you want to do via predicates. For example @view_config(route_name='route', xhr=True, renderer='json') @view_config(route_name='route', renderer='r.mako') @view_config