Cleanup for Refactor-error-messages
This patch is a clean-up patch for refactor-error-messages bp which remove the exception message from base message otherwise the same exception message display twice like this https://ibb.co/XyFWMdz . Change-Id: Ib56b35b164057b821b5e9755202b87c9e1ea5572
This commit is contained in:
parent
d46e3cf3e4
commit
0af8c03faf
|
@ -130,8 +130,8 @@ class CreateForm(forms.SelfHandlingForm):
|
||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _('Failed to create action: %s') % e
|
msg = _('Failed to create action.')
|
||||||
redirect = reverse('horizon:mistral:actions:index')
|
redirect = reverse('horizon:mistral:actions:index')
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class UpdateForm(forms.SelfHandlingForm):
|
||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _('Failed to update action: %s') % e
|
msg = _('Failed to update action.')
|
||||||
redirect = reverse('horizon:mistral:actions:index')
|
redirect = reverse('horizon:mistral:actions:index')
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
|
@ -97,10 +97,10 @@ class IndexView(tables.DataTableView):
|
||||||
reverse=False
|
reverse=False
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception:
|
||||||
self._prev = False
|
self._prev = False
|
||||||
self._more = False
|
self._more = False
|
||||||
msg = _('Unable to retrieve actions list: %s') % str(e)
|
msg = _('Unable to retrieve actions list.')
|
||||||
exceptions.handle(self.request, msg)
|
exceptions.handle(self.request, msg)
|
||||||
|
|
||||||
return actions
|
return actions
|
||||||
|
|
|
@ -39,7 +39,7 @@ class UpdateDescriptionForm(forms.SelfHandlingForm):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _('Failed to update execution description: %s') % e
|
msg = _('Failed to update execution description.')
|
||||||
redirect = reverse('horizon:mistral:executions:index')
|
redirect = reverse('horizon:mistral:executions:index')
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
|
@ -145,12 +145,9 @@ class UpdateRow(tables.Row):
|
||||||
def get_data(self, request, id):
|
def get_data(self, request, id):
|
||||||
try:
|
try:
|
||||||
instance = api.execution_get(request, id)
|
instance = api.execution_get(request, id)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _("Unable to get execution by ID %(id)s: %(e)s.") % {
|
msg = _('Unable to get execution by ID "%s".') % id
|
||||||
'id': id, 'e': str(e)
|
|
||||||
}
|
|
||||||
exceptions.handle(request, msg)
|
exceptions.handle(request, msg)
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,12 +113,11 @@ class IndexView(tables.DataTableView):
|
||||||
reverse=True
|
reverse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception:
|
||||||
self._prev = False
|
self._prev = False
|
||||||
self._more = False
|
self._more = False
|
||||||
msg = _('Unable to retrieve executions list: %s') % e
|
msg = _('Unable to retrieve executions list.')
|
||||||
exceptions.handle(self.request, msg)
|
exceptions.handle(self.request, msg)
|
||||||
|
|
||||||
return executions
|
return executions
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,15 +167,12 @@ class TasksView(tables.DataTableView):
|
||||||
reverse=True
|
reverse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception:
|
||||||
self._prev = False
|
self._prev = False
|
||||||
self._more = False
|
self._more = False
|
||||||
msg = (
|
msg = _('Unable to retrieve executions list of '
|
||||||
_('Unable to retrieve executions list of '
|
'the requested task.')
|
||||||
'the requested task: %s') % e
|
|
||||||
)
|
|
||||||
exceptions.handle(self.request, msg)
|
exceptions.handle(self.request, msg)
|
||||||
|
|
||||||
return executions
|
return executions
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,9 @@ class UpdateRow(tables.Row):
|
||||||
def get_data(self, request, id):
|
def get_data(self, request, id):
|
||||||
try:
|
try:
|
||||||
instance = api.task_get(request, id)
|
instance = api.task_get(request, id)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _("Unable to get task by ID %(id)s: %(e)s.") % {
|
msg = _('Unable to get task by ID "%s".') % id
|
||||||
'id': id, 'e': str(e)
|
|
||||||
}
|
|
||||||
exceptions.handle(request, msg)
|
exceptions.handle(request, msg)
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,8 @@ class CreateForm(forms.SelfHandlingForm):
|
||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _('Failed to create workbook: %s') % e
|
msg = _('Failed to create workbook.')
|
||||||
redirect = reverse('horizon:mistral:workbooks:index')
|
redirect = reverse('horizon:mistral:workbooks:index')
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class UpdateForm(CreateForm):
|
||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _('Failed to update workbook: %s') % e
|
msg = _('Failed to update workbook.')
|
||||||
redirect = reverse('horizon:mistral:workbooks:index')
|
redirect = reverse('horizon:mistral:workbooks:index')
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
|
@ -69,8 +69,8 @@ class ExecuteForm(forms.SelfHandlingForm):
|
||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _('Failed to execute workflow "%s".') % e
|
msg = _('Failed to execute workflow.')
|
||||||
redirect = reverse('horizon:mistral:workflows:index')
|
redirect = reverse('horizon:mistral:workflows:index')
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
||||||
|
@ -159,8 +159,8 @@ class CreateForm(forms.SelfHandlingForm):
|
||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _('Failed to create workflow: %s') % e
|
msg = _('Failed to create workflow.')
|
||||||
redirect = reverse('horizon:mistral:workflows:index')
|
redirect = reverse('horizon:mistral:workflows:index')
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ class UpdateForm(CreateForm):
|
||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
msg = _('Failed to update workflow: %s') % e
|
msg = _('Failed to update workflow.')
|
||||||
redirect = reverse('horizon:mistral:workflows:index')
|
redirect = reverse('horizon:mistral:workflows:index')
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
Loading…
Reference in New Issue