Merge "Remove redundant exception handling"
This commit is contained in:
commit
ee3680a4d6
|
@ -17,7 +17,6 @@ from django.urls import reverse
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ungettext_lazy
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
|
||||
from mistraldashboard import api
|
||||
|
@ -31,14 +30,7 @@ class UpdateRow(tables.Row):
|
|||
ajax = True
|
||||
|
||||
def get_data(self, request, id):
|
||||
try:
|
||||
instance = api.action_execution_get(request, id)
|
||||
except Exception as e:
|
||||
msg = _("Unable to get action execution by ID %(id)s: %(e)s.") % {
|
||||
'id': id, 'e': str(e)
|
||||
}
|
||||
exceptions.handle(request, msg)
|
||||
|
||||
instance = api.action_execution_get(request, id)
|
||||
return instance
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ from django.urls import reverse_lazy
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views import generic
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon import tables
|
||||
|
||||
|
@ -30,17 +29,11 @@ from mistraldashboard import forms as mistral_forms
|
|||
|
||||
|
||||
def get_single_action_execution_data(request, **kwargs):
|
||||
try:
|
||||
action_execution_id = kwargs['action_execution_id']
|
||||
action_execution = api.action_execution_get(
|
||||
request,
|
||||
action_execution_id
|
||||
)
|
||||
except Exception:
|
||||
msg = _('Unable to get action execution "%s".') % action_execution_id
|
||||
redirect = reverse('horizon:mistral:action_executions:index')
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
action_execution_id = kwargs['action_execution_id']
|
||||
action_execution = api.action_execution_get(
|
||||
request,
|
||||
action_execution_id
|
||||
)
|
||||
return action_execution
|
||||
|
||||
|
||||
|
@ -161,14 +154,7 @@ class FilteredByTaskView(tables.DataTableView):
|
|||
data = {}
|
||||
|
||||
def get_data(self, **kwargs):
|
||||
try:
|
||||
task_id = self.kwargs['task_id']
|
||||
data = api.action_executions_list(self.request, task_id)
|
||||
except Exception:
|
||||
msg = (
|
||||
_('Unable to get action execution by task id "%s".') % task_id
|
||||
)
|
||||
redirect = reverse('horizon:mistral:action_executions:index')
|
||||
exceptions.handle(self.request, msg, redirect=redirect)
|
||||
task_id = self.kwargs['task_id']
|
||||
data = api.action_executions_list(self.request, task_id)
|
||||
|
||||
return data
|
||||
|
|
Loading…
Reference in New Issue