In Pyramid, templates are statically assigned to view with
@view_config(renderer='templates/foo.pt')
def my_view(request):
return {'foo':1, 'bar':2}
However, in some cases, we want to set different template for each user. For example, user1
use templates from templates/style1/xxx.pt
and user2
use templates from templates/style2/xxx.pt
. Thus, we need a way to dynamically pass templates to views, instead of configure them statically.
Is there anyway to do the task elegantly?