I’ve recently upgraded my Pylons to version 1.0 for the CMS project I’m working on and few things broke as a result. There were some changes in dependency packages as well, most notably changing of url_for to url which had to be replaced everywhere within the code.
However the most irritating problem was with attributes of template context, mainly because of their absence in the templates. Template context in previous versions of Pylons worked in a manner that whenever there was no attribute in the template context object “c” it would be created on the fly being an empty string. Pylons 1.0 changed this behavior so you had to explicitly create the attribute. Given the scale of the project I’m not willing to go through each template out of more than hundred and then check whether or not I forgot some attribute.
Googling a little bit gave answer that you had to insert this line into config/environment.py:
config['pylons.strict_c'] = False
just before your template customization, but it didn’t work!
I’ve been looking for an answer to this problem for quite some time and found that if you change the above line from pylons.strict_c to:
config['pylons.strict_tmpl_context'] = False
it will happily work. So there you are. 🙂