Using Evoque's very dynamic template inheritance can be a simple and effective way to manage a theme for a site. In addition, should we need to manage multiple themes,and then let the user choose, we can achieve this simply via multiple site base templates. Once parametrized, we can simply expose the value as a user preference, and remember it in any way that is convenient e.g. as a key in the user's pylons session.
To parametrize the base template of a template inheritance chain, it boils down to doing something as simple as:
$overlay{name=my_site_theme}
where, on each rendering, which base template to be used is determined by the runtime value of my_site_theme – this is what we set the user preference to on each rendering, for example:
class MyController(BaseController):
def index(self):
# Return a rendered template with evoque
#
# previously set:
# session["my_site_theme"] = "site_base_tables.html"
#
c.my_site_theme = session["my_site_theme"]
return render("template.html")
A more general description of how this works is at: http://evoque.gizmojo.org/howto/site-template/