horizon/horizon/tables
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
..
__init__.py hacking: noqa cleanup in horizon 2017-03-17 19:38:47 +00:00
actions.py Avoid duplicated message in Batch/DeleteAction 2018-01-23 22:46:25 +09:00
base.py Fix actions inside instance details view page 2017-09-07 01:08:41 +04:00
formset.py Drop izip and izip_longest removed in python3 2016-01-14 16:39:07 +08:00
views.py Fix H405 (multi line docstring) warnings (horizon) 2017-06-09 16:04:57 +00:00