horizon/horizon
Akihiro Motoki a96e632bf5 Avoid duplicated message in Batch/DeleteAction
Previously BatchAction.handle() automatically adds an error message
when handle() method raises an exception. If some custom error message
is shown in handle() method, two error messages will be shown.

This commit allows a special handling for HandledException to
BatchAction.handle(). In individual BatchAction instances,
handle() method can now show a custom error message and raise an
HandledException, and then BatchAction.handle() skips to show an
error message for that. The reason of using HandledException is
because the exception can be raised from exceptions.handle() function
which is commonly used to handle exceptions.

The common pattern in handle() would be:

 try:
    <do something>
 except Exception as e:
    # HandledException which wrapps the original exception will be raised.
    # HandledException will be caught by BatchAction.handle().
    exceptions.handle(request, msg, escalate=True)

To make it easier to use the pattern, a new decorator
horizon.tables.actions.handle_exception_with_detail_message is introduced.

Partial-Bug: #1733207
Change-Id: I4bb0f61c7b63ea6ecd2e30c03eddecee62ff9b13
2018-01-23 22:46:25 +09:00
..
browsers Revert "Enable to refresh ngdetails view" 2017-08-02 18:31:22 +00:00
conf hacking: noqa cleanup in horizon 2017-03-17 19:38:47 +00:00
contrib Fix H405 (multi line docstring) warnings (horizon) 2017-06-09 16:04:57 +00:00
forms Add render method to ThemableCheckboxSelectMultiple 2017-10-12 04:39:27 +00:00
hacking Eliminate mutable default arguments 2015-12-17 09:58:46 +00:00
locale Imported Translations from Zanata 2018-01-20 06:34:18 +00:00
management pull_catalog: avoid internet access during module loading 2017-11-21 11:57:43 +00:00
middleware Remove unused code (_logout method and auth_views in base.py) 2017-09-18 08:19:32 +00:00
static Merge "Added error msg when gets redirect to login page" 2018-01-10 16:15:20 +00:00
tables Avoid duplicated message in Batch/DeleteAction 2018-01-23 22:46:25 +09:00
tabs Fix H405 (multi line docstring) warnings (horizon) 2017-06-09 16:04:57 +00:00
templates Merge "Use specified phrases in lieu of 'Used' for limit summary" 2017-11-14 13:30:45 +00:00
templatetags Use flake8-import-order plugin 2017-07-03 08:02:23 +00:00
test Avoid duplicated message in Batch/DeleteAction 2018-01-23 22:46:25 +09:00
utils Merge "Make @memoize thread-aware" 2017-09-11 21:30:00 +00:00
workflows Switch render() arguments to the new way 2017-06-21 19:32:03 +00:00
__init__.py Revert "Enable to refresh ngdetails view" 2017-08-02 18:31:22 +00:00
base.py Revert "No need to discover panel in Site class" 2017-09-21 10:46:12 +00:00
context_processors.py Remove extraneous vim configuration comments 2014-05-06 15:30:10 +08:00
decorators.py hacking: noqa cleanup in horizon 2017-03-17 19:38:47 +00:00
exceptions.py Show NotAuthorized error message on a separate page 2017-08-29 16:37:04 +03:00
karma.conf.js Makes the xstatic files lookup dynamic in the tests 2017-07-27 10:01:33 -04:00
loaders.py hacking: noqa cleanup in horizon 2017-03-17 19:38:47 +00:00
messages.py hacking: noqa cleanup in horizon 2017-03-17 19:38:47 +00:00
notifications.py Ensure log messages are not translated 2017-04-11 10:24:01 +00:00
site_urls.py hacking: noqa cleanup in horizon 2017-03-17 19:38:47 +00:00
themes.py Added SELECTABLE_THEMES setting 2017-07-26 11:52:35 +01:00
version.py Remove extraneous vim configuration comments 2014-05-06 15:30:10 +08:00
views.py flake8-import-order: Ensure to place project imports last 2017-09-20 01:19:38 +00:00