For a while I've been thinking about how to achieve themes in some of my Pylons applications, and just today I was looking around in my environment.py file, and saw the configuration of the templates and public directories. That gave me an idea, can I load a theme directory from the configuration file and use it in there?
I had a bit of a false start initially, I thought that I could just use the config object as I do elsewhere in my application, but that didn't want to work. Eventually I found the solution: the app_conf object.
This is how my code now looks: