Djblets.extensions.TemplateHook applies_to() sandboxing
Review Request #6545 — Created Oct. 31, 2014 and submitted
Extensions that create a TemplateHook subclass with a new applies_to function can throw an exception inside Djblets. The part of Djblets that calls that method has been sandboxed.
Now when a TemplateHook subclass's applies_to() function from an extension throws an exception; Djblets logs the error.
Unit test has been written to make sure that applies_to() from a TemplateHook subclass has been called, and when an exception is thrown it gets logged.
The test fails without the sanboxing, and succeeds with it.
Description | From | Last Updated |
---|---|---|
Space should go on the first line instead of the second. |
chipx86 | |
Can we also check the resulting string? That'll help make sure we're not unintentionally showing some big Django traceback. |
chipx86 | |
The indentation here broke the logic. It used to be that the "try: yield" was inside the hook.applies_to conditional. Now … |
david |
- Summary:
-
[WIP] Djblets.extensions.TemplateHook applies_to() sandboxingDjblets.extensions.TemplateHook applies_to() sandboxing
- Description:
-
Extensions that create a TemplateHook subclass with a new applies_to function can throw an exception inside Djblets. The part of Djblets that calls that method has been sandboxed.
Now when a TemplateHook subclass's applies_to() function from an extension throws an exception; Djblets logs the error.
- - TODO:
- Fix an error: TypeError: unbound method applies_to() must be called with SandboxTemplateHook - Add the sandboxing - Commit:
-
39717d48587a0603bd86d5edca49de19a755883e72345d489ab006806a7519af138490df60ee2624
-
Tool: Pyflakes Processed Files: djblets/extensions/templatetags/djblets_extensions.py djblets/extensions/tests.py Tool: PEP8 Style Checker Processed Files: djblets/extensions/templatetags/djblets_extensions.py djblets/extensions/tests.py
-
Tool: PEP8 Style Checker Processed Files: djblets/extensions/templatetags/djblets_extensions.py djblets/extensions/tests.py Tool: Pyflakes Processed Files: djblets/extensions/templatetags/djblets_extensions.py djblets/extensions/tests.py