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: I89df4b9681da759ba5a5b898f1de63e85351bbce
This commit is contained in:
manchandavishal 2020-08-28 18:59:55 +00:00
parent 94ed6df481
commit b1a2f6c77b
3 changed files with 25 additions and 25 deletions

View File

@ -371,10 +371,10 @@ class LaunchForm(forms.SelfHandlingForm):
messages.success(request,
_('Launched cluster "%s"') % data['name'])
return True
except Exception as e:
except Exception:
redirect = reverse("horizon:project:database_clusters:index")
exceptions.handle(request,
_('Unable to launch cluster. %s') % e,
_('Unable to launch cluster.'),
redirect=redirect)
@ -473,10 +473,10 @@ class ClusterAddInstanceForm(forms.SelfHandlingForm):
data.get('type', None),
data.get('related_to', None),
data.get('network', None))
except Exception as e:
except Exception:
redirect = reverse("horizon:project:database_clusters:index")
exceptions.handle(request,
_('Unable to grow cluster. %s') % e,
_('Unable to grow cluster.'),
redirect=redirect)
return True
@ -497,8 +497,8 @@ class ResetPasswordForm(forms.SelfHandlingForm):
password)
messages.success(request, _('Root password updated for '
'cluster "%s"') % cluster_id)
except Exception as e:
except Exception:
redirect = reverse("horizon:project:database_clusters:index")
exceptions.handle(request, _('Unable to reset password. %s') % e,
exceptions.handle(request, _('Unable to reset password.'),
redirect=redirect)
return True

View File

@ -103,10 +103,10 @@ class CreateConfigurationForm(forms.SelfHandlingForm):
datastore_version=datastore_version)
messages.success(request, _('Created configuration group'))
except Exception as e:
except Exception:
redirect = reverse("horizon:project:database_configurations:index")
exceptions.handle(request, _('Unable to create configuration '
'group. %s') % e, redirect=redirect)
'group.'), redirect=redirect)
return True
@ -181,9 +181,9 @@ class AddParameterForm(forms.SelfHandlingForm):
data["name"], self.parameters).type,
data["value"])))
messages.success(request, _('Successfully added parameter'))
except Exception as e:
except Exception:
redirect = reverse("horizon:project:database_configurations:index")
exceptions.handle(request,
_('Unable to add new parameter: %s') % e,
_('Unable to add new parameter.'),
redirect=redirect)
return True

View File

@ -43,10 +43,10 @@ class CreateDatabaseForm(forms.SelfHandlingForm):
messages.success(request,
_('Created database "%s".') % data['name'])
except Exception as e:
except Exception:
redirect = reverse("horizon:project:databases:detail",
args=(instance,))
exceptions.handle(request, _('Unable to create database. %s') % e,
exceptions.handle(request, _('Unable to create database.'),
redirect=redirect)
return True
@ -85,9 +85,9 @@ class ResizeVolumeForm(forms.SelfHandlingForm):
data['new_size'])
messages.success(request, _('Resizing volume "%s"') % instance)
except Exception as e:
except Exception:
redirect = reverse("horizon:project:databases:index")
exceptions.handle(request, _('Unable to resize volume. %s') % e,
exceptions.handle(request, _('Unable to resize volume.'),
redirect=redirect)
return True
@ -123,9 +123,9 @@ class ResizeInstanceForm(forms.SelfHandlingForm):
api.trove.instance_resize(request, instance, flavor)
messages.success(request, _('Resizing instance "%s"') % instance)
except Exception as e:
except Exception:
redirect = reverse("horizon:project:databases:index")
exceptions.handle(request, _('Unable to resize instance. %s') % e,
exceptions.handle(request, _('Unable to resize instance.'),
redirect=redirect)
return True
@ -141,12 +141,12 @@ class PromoteToReplicaSourceForm(forms.SelfHandlingForm):
messages.success(
request,
_('Promoted replica "%s" as the new replica source.') % name)
except Exception as e:
except Exception:
redirect = reverse("horizon:project:databases:index")
exceptions.handle(
request,
_('Unable to promote replica as the new replica source. "%s"')
% e, redirect=redirect)
_('Unable to promote replica as the new replica source.'),
redirect=redirect)
return True
@ -178,10 +178,10 @@ class CreateUserForm(forms.SelfHandlingForm):
messages.success(request,
_('Created user "%s".') % data['name'])
except Exception as e:
except Exception:
redirect = reverse("horizon:project:databases:detail",
args=(instance,))
exceptions.handle(request, _('Unable to create user. %s') % e,
exceptions.handle(request, _('Unable to create user.'),
redirect=redirect)
return True
@ -227,10 +227,10 @@ class EditUserForm(forms.SelfHandlingForm):
messages.success(request,
_('Updated user "%s".') % data['user_name'])
except Exception as e:
except Exception:
redirect = reverse("horizon:project:databases:detail",
args=(instance,))
exceptions.handle(request, _('Unable to update user. %s') % e,
exceptions.handle(request, _('Unable to update user.'),
redirect=redirect)
return True
@ -275,9 +275,9 @@ class AttachConfigurationForm(forms.SelfHandlingForm):
messages.success(request, _('Attaching Configuration group "%s"')
% instance_id)
except Exception as e:
except Exception:
redirect = reverse("horizon:project:databases:index")
exceptions.handle(request, _('Unable to attach configuration '
'group. %s') % e,
'group.'),
redirect=redirect)
return True