Sandbox reviewboard.admin.widgets.Widget
Review Request #6650 — Created Nov. 27, 2014 and submitted
Extensions that create a Widget subclass (using the AdminWidgetHook) can throw exceptions inside Reviewboard. The parts of Reviewboard that call those methods have been sandboxed.
Now when a Widget subclass from an extension throws an exception; Reviewboard logs the errors with enough information to find which method in the Widget subclass threw the exception.
Unit tests have been written to make sure that functions from a Widget subclass have been called, and when an exception is thrown it gets logged.
The tests fail without the sanboxing, and succeed with it.
Admin UI displays the widgets in the correct column.
When the "X" in the corner is clicked it closes the widget, but does refresh the page.
Description | From | Last Updated |
---|---|---|
"Testing admin widget sandboxing for ..." Same below. |
chipx86 | |
This isn't always going to be clear which went wrong. Instead, the lambda function should call a new, private function … |
chipx86 | |
This needs to return the generated data. Make sure the admin UI is working as expected after this change. It … |
chipx86 | |
No blank line. |
chipx86 |
-
-
-
This isn't always going to be clear which went wrong.
Instead, the lambda function should call a new, private function that calls self.generate_data and wraps that in a try/except.
generate_cache_key
should be called prior to thecache_memoize
, wrapped in a try/except. The resulting key can then be passed tocache_memoize
outside the try/except.
-
Tool: PEP8 Style Checker Processed Files: reviewboard/admin/widgets.py reviewboard/admin/tests.py Tool: Pyflakes Processed Files: reviewboard/admin/widgets.py reviewboard/admin/tests.py
-
-
This needs to return the generated data. Make sure the admin UI is working as expected after this change.
It should also raise an exception that can be caught later when calling
cache_memoize
. (The exception can then be ignored in that callback.)The reason for that is that we don't want
cache_memoize
to either store aNone
value (as the exception may be temporary, so we want to try again), and for the same reasons we don't want to store any other default value. An exception will guarantee that nothing is cached.You can just re-raise and then catch in the
try/except
for thecache_memoize
call. -
-
Tool: Pyflakes Processed Files: reviewboard/admin/widgets.py reviewboard/admin/tests.py Tool: PEP8 Style Checker Processed Files: reviewboard/admin/widgets.py reviewboard/admin/tests.py
- Testing Done:
-
Unit tests have been written to make sure that functions from a Widget subclass have been called, and when an exception is thrown it gets logged.
The tests fail without the sanboxing, and succeed with it.
+ + Admin UI displays the widgets in the correct column.
+ When the "X" in the corner is clicked it closes the widget, but does refresh the page. - Commit:
-
5e8752c31ea05cbb043ed4f7eac91779b764d3efcf2b79145bc167891f160b5cf007a920a4b29f89
- Diff:
-
Revision 4 (+6 -4)
- Added Files: