Fix leaking data between TemplateHooks and add sandboxing.
Review Request #5761 — Created May 1, 2014 and submitted
TemplateHooks could easily leak data into the main context when
rendering, overriding variables provided by other contexts. While
TemplateHook tries to push/pop, subclasses can always override and
forget to do so. They can also potentially raise an exception, breaking
the rendering of the page.To work around all this, we now push/pop in template_hook_point, to
prevent any leakage, and catch exceptions to help sandbox.
Unit tests pass.
First saw this issue when rbmotd's custom TemplateHook was writing directly
into the context, causing issues with the Power Pack config page. After this
change, it all worked properly.
Description | From | Last Updated |
---|---|---|
This doesn't need to be in a "finally" block, it can just be another line after the try/except. |
david |