Theming Chiselman
I wanted to make some cosmetic changes to the the layout and colors of this blog, after some complained about 'white-on-black' text.
So, I went about adding "theme" feature to chiselman instead of overwriting the templates.
This is how I did it, by overriding pylons' default render_reponse
def render_response(*args,**kargs):
tmp = args
theme = read_theme_name() #from global conf file
if theme:
path = '/%s%s' %(theme,args[0])
args = [path]
args = args + list(tmp[1:])
return pylons.Response(render(*args, **kargs))
And added one more entry themes to the paths[templates] in config/environments.py
paths = {'root_path': root_path,
'controllers': os.path.join(root_path, 'controllers'),
'templates': [os.path.join(root_path, path) for path in
('components', 'themes', 'templates')],
'static_files': os.path.join(root_path, 'public')
}
Created a folder called themes in the same level as 'templates'. All the files belonging to a theme go under a folder below 'templates' folder.
Set the theme name in your .ini file under [app:main] directive. (I'm hard coding that value currently, because I have only one theme right now ;)
Next steps: 1. Akismet - too many spam comments
Captchas - contact form has become a spam attractor :(
Admin interface - I will be able to release the code once I get this done.
§