Yesterday I looked at very simple theming in Pylons, and mentioned that I'd prefer loading the current theme from the database rather than the configuration file. So this evening I decided to see if I could achieve that.
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: