Djblets.extensions.TemplateHook applies_to() sandboxing
Review Request #6545 — Created Oct. 31, 2014 and submitted
Information | |
---|---|
justy777 | |
Djblets | |
master | |
f27a497... | |
Reviewers | |
djblets, students | |
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. |
|
|
Can we also check the resulting string? That'll help make sure we're not unintentionally showing some big Django traceback. |
|
|
The indentation here broke the logic. It used to be that the "try: yield" was inside the hook.applies_to conditional. Now … |
|
Summary: |
|
|||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||
Commit: |
|
|||||||||||||||||||||
Diff: |
Revision 2 (+28 -4) |

-
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
-
Looks good! Couple small things.
-
djblets/extensions/templatetags/djblets_extensions.py (Diff revision 2) Space should go on the first line instead of the second.
-
djblets/extensions/tests.py (Diff revision 2) Can we also check the resulting string? That'll help make sure we're not unintentionally showing some big Django traceback.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+30 -4) |

-
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
-
-
djblets/extensions/templatetags/djblets_extensions.py (Diff revision 3) The indentation here broke the logic. It used to be that the "try: yield" was inside the hook.applies_to conditional. Now that will only get called in the case that applies_to raises an exception.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+39 -12) |