Fix leaking data between TemplateHooks and add sandboxing.

Review Request #5761 — Created May 1, 2014 and submitted — Latest diff uploaded

Information

Djblets
master
8297cc7...

Reviewers

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.

    Loading...