I'd write a new renderer, register it as the .jinja2 renderer, let it sort
out the lookup logic.

Chris

On Wed, May 20, 2015 at 2:35 PM, juha <[email protected]>
wrote:

> Hello,
>
> I wanted to ask the community about this question I have concerning view
> renderers: say I wanted to add a level of indirection between the view
> callables and the associated renderer that I want to be determined at
> runtime (for example, I don't want to hardcode a specific template to a
> function with the view_config decorator, I want to select one of several
> versions of the template for WWW requests based on the logged in user's
> preference, debugging, etc.).
>
> My use-case is creating a new layout for a website, and then having the
> templates in a path like v1/user/profile.jinja2 and v2/user/profile.jinja2,
> and having both available at the same time (a db table decides which user
> sees which) until the new layout is sufficiently tested to be rolled out to
> all users.
>
> I understand this can be done with a NewRequest subscriber. Is this the
> canonical way if I know it's going to be used on every request?
>
> Thanks for the help!
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to