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 .

Depends-On: https://review.opendev.org/#/c/708069/
Change-Id: I3ff5f7b25c0e91e67a8c98020993676d6345379e
This commit is contained in:
manchandavishal 2020-08-28 18:59:55 +00:00
parent a72fd198c9
commit 9e777ec9a4
7 changed files with 14 additions and 16 deletions

View File

@ -109,7 +109,7 @@ class DetailView(horizon.tables.MultiTableView):
except Exception as exc:
LOG.exception(exc)
actions = []
msg = _('Action list can not be retrieved: %s') % str(exc)
msg = _('Action list can not be retrieved.')
horizon.exceptions.handle(self.request, msg)
return actions

View File

@ -42,10 +42,10 @@ class IndexView(horizon.tables.DataTableView):
search_opts = self.get_filters()
try:
actions = watcher.Action.list(self.request, **search_opts)
except Exception as e:
except Exception:
horizon.exceptions.handle(
self.request,
_("Unable to retrieve action information: %s") % str(e))
_("Unable to retrieve action information."))
return actions
def get_actions_count(self):

View File

@ -131,7 +131,7 @@ class CreateForm(forms.SelfHandlingForm):
messages.success(request, message)
return audit_tpl
except Exception as exc:
msg = _('Failed to create audit template: %s') % str(exc)
msg = _('Failed to create audit template.')
LOG.info(exc)
redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect)

View File

@ -52,8 +52,7 @@ class IndexView(horizon.tables.DataTableView):
LOG.exception(exc)
horizon.exceptions.handle(
self.request,
_("Unable to retrieve audit template "
"information: %s") % str(exc))
_("Unable to retrieve audit template information."))
return audit_templates
def get_count(self):
@ -118,7 +117,7 @@ class DetailView(horizon.tabs.TabbedTableView):
except Exception as exc:
LOG.exception(exc)
audits = []
msg = _('Audits list cannot be retrieved: %s') % str(exc)
msg = _('Audits list cannot be retrieved.')
horizon.exceptions.handle(self.request, msg)
return audits

View File

@ -56,10 +56,10 @@ class IndexView(horizon.tables.DataTableView):
search_opts = self.get_filters()
try:
audits = watcher.Audit.list(self.request, **search_opts)
except Exception as e:
except Exception:
horizon.exceptions.handle(
self.request,
_("Unable to retrieve audit information: %s") % str(e))
_("Unable to retrieve audit information."))
return audits
def get_audits_count(self):
@ -117,7 +117,7 @@ class DetailView(horizon.tables.MultiTableView):
except Exception as exc:
LOG.exception(exc)
audits = []
msg = _('Action plan list cannot be retrieved: %s') % str(exc)
msg = _('Action plan list cannot be retrieved.')
horizon.exceptions.handle(self.request, msg)
return audits

View File

@ -45,10 +45,10 @@ class IndexView(horizon.tables.DataTableView):
search_opts = self.get_filters()
try:
goals = watcher.Goal.list(self.request, **search_opts)
except Exception as e:
except Exception:
horizon.exceptions.handle(
self.request,
_("Unable to retrieve goal information: %s") % str(e))
_("Unable to retrieve goal information."))
return goals
def get_goals_count(self):
@ -97,7 +97,7 @@ class DetailView(horizon.tables.MultiTableView):
except Exception as exc:
LOG.exception(exc)
strategies = []
msg = _('Strategy list cannot be retrieved: %s') % str(exc)
msg = _('Strategy list cannot be retrieved.')
horizon.exceptions.handle(self.request, msg)
return strategies
@ -110,8 +110,7 @@ class DetailView(horizon.tables.MultiTableView):
except Exception as exc:
LOG.exception(exc)
indicators_spec = []
msg = _('Efficacy specification cannot be '
'retrieved: %s') % str(exc)
msg = _('Efficacy specification cannot be retrieved.')
horizon.exceptions.handle(self.request, msg)
return indicators_spec

View File

@ -48,7 +48,7 @@ class IndexView(horizon.tables.DataTableView):
LOG.exception(exc)
horizon.exceptions.handle(
self.request,
_("Unable to retrieve strategy information: %s") % str(exc))
_("Unable to retrieve strategy information."))
return strategies
def get_strategies_count(self):