render_template using a list of templates #409

merged 1 commit into from Feb 24, 2012


None yet
2 participants

dmishe commented Feb 24, 2012

This would be very handy for dynamic template selection. For example i would override some templates based on type of content rendered.

render_template(['%s.html % type, 'index.html'])

rduplain commented Feb 24, 2012

You can already choose a template using a Jinja loader:

Does this gisted approach suffice?


dmishe commented Feb 24, 2012

It so much code, and i would say that it solves more global problem than just selecting templates. Also this has no drawbacks, because Jinja will not do any extra work if you pass it string.

This is very small change for IMO often used approach to custom templates.

rduplain merged commit 0b33693 into pallets:master Feb 24, 2012


rduplain commented Feb 25, 2012

You're right, the Jinja loader approach solves the general problem, and your pull request exposes in render_template methods that Jinja already has available. Pulled, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment