diff --git a/senlin_dashboard/cluster/clusters/forms.py b/senlin_dashboard/cluster/clusters/forms.py index 33b4b427..21bcbd78 100644 --- a/senlin_dashboard/cluster/clusters/forms.py +++ b/senlin_dashboard/cluster/clusters/forms.py @@ -86,10 +86,10 @@ class CreateForm(forms.SelfHandlingForm): msg = _('Creating cluster "%s" successfully') % data['name'] messages.success(request, msg) return cluster - except Exception as e: + except Exception: redirect = reverse(INDEX_URL) exceptions.handle(request, - _("Unable to create cluster: %s") % e, + _("Unable to create cluster."), redirect=redirect) @@ -124,8 +124,8 @@ class ManagePoliciesForm(forms.SelfHandlingForm): "cluster": data['cluster_id']} messages.success(request, msg) return attach - except Exception as e: + except Exception: redirect = reverse(INDEX_URL) exceptions.handle(request, - _("Unable to attach policy: %s") % e, + _("Unable to attach policy."), redirect=redirect) diff --git a/senlin_dashboard/cluster/clusters/views.py b/senlin_dashboard/cluster/clusters/views.py index 7339d0ba..0d3e4172 100644 --- a/senlin_dashboard/cluster/clusters/views.py +++ b/senlin_dashboard/cluster/clusters/views.py @@ -57,10 +57,10 @@ class IndexView(tables.DataTableView): paginate=True, reversed_order=reversed_order, filters=filters) - except Exception as e: + except Exception: self._prev = self._more = False clusters = [] - msg = _('Unable to retrieve clusters: %s') % e + msg = _('Unable to retrieve clusters.') exceptions.handle(self.request, msg) return clusters @@ -91,8 +91,8 @@ class DetailView(tabs.TabView): cluster = senlin.cluster_get(self.request, cluster_id) cluster.profile_url = reverse_lazy(self.profile_url, args=[cluster.profile_id]) - except Exception as e: - msg = _("Unable to retrieve cluster: %s") % e + except Exception: + msg = _("Unable to retrieve cluster.") url = reverse_lazy(clusters_forms.INDEX_URL) exceptions.handle(self.request, msg, redirect=url) return cluster diff --git a/senlin_dashboard/cluster/nodes/forms.py b/senlin_dashboard/cluster/nodes/forms.py index 986674b5..8a552f57 100644 --- a/senlin_dashboard/cluster/nodes/forms.py +++ b/senlin_dashboard/cluster/nodes/forms.py @@ -85,10 +85,10 @@ class CreateForm(forms.SelfHandlingForm): msg = _('Creating node "%s" successfully') % data['name'] messages.info(request, msg) return node - except Exception as e: + except Exception: redirect = reverse("horizon:cluster:nodes:index") exceptions.handle(request, - _("Unable to create node: %s") % e, + _("Unable to create node."), redirect=redirect) @@ -132,9 +132,9 @@ class UpdateNodeForm(forms.SelfHandlingForm): ' has been accepted for processing.') % data['name']) return node - except Exception as e: + except Exception: redirect = reverse("horizon:cluster:nodes:index") exceptions.handle(request, - _("Unable to update node: %s") % e, + _("Unable to update node."), redirect=redirect) return False diff --git a/senlin_dashboard/cluster/nodes/views.py b/senlin_dashboard/cluster/nodes/views.py index 4a65b073..990d1d7f 100644 --- a/senlin_dashboard/cluster/nodes/views.py +++ b/senlin_dashboard/cluster/nodes/views.py @@ -57,10 +57,10 @@ class IndexView(tables.DataTableView): paginate=True, reversed_order=reversed_order, filters=filters) - except Exception as e: + except Exception: self._prev = self._more = False nodes = [] - msg = _('Unable to retrieve nodes: %s') % e + msg = _('Unable to retrieve nodes.') exceptions.handle(self.request, msg) return nodes @@ -90,8 +90,8 @@ class DetailView(tabs.TabView): # Get initial node information node_id = self.kwargs["node_id"] node = senlin.node_get(self.request, node_id) - except Exception as e: - msg = _("Unable to retrieve node: %s") % e + except Exception: + msg = _("Unable to retrieve node.") url = reverse_lazy("horizon:cluster:nodes:index") exceptions.handle(self.request, msg, redirect=url) return node @@ -145,8 +145,8 @@ class UpdateView(forms.ModalFormView): "role": node.role, "metadata": metadata} - except Exception as e: - msg = _("Unable to retrieve node: %s") % e + except Exception: + msg = _("Unable to retrieve node.") url = reverse_lazy("horizon:cluster:nodes:index") exceptions.handle(self.request, msg, redirect=url) return node_dict diff --git a/senlin_dashboard/cluster/policies/forms.py b/senlin_dashboard/cluster/policies/forms.py index 09a4a8d6..731c3c43 100644 --- a/senlin_dashboard/cluster/policies/forms.py +++ b/senlin_dashboard/cluster/policies/forms.py @@ -90,9 +90,9 @@ class CreatePolicyForm(forms.SelfHandlingForm): _('Your policy %s has been created.') % args['name']) return policy - except Exception as e: + except Exception: redirect = reverse(INDEX_URL) - msg = _('Unable to create new policy: %s') % e + msg = _('Unable to create new policy.') exceptions.handle(request, msg, redirect=redirect) return False @@ -113,8 +113,8 @@ class UpdatePolicyForm(forms.SelfHandlingForm): except ValidationError as e: self.api_error(e.messages[0]) return False - except Exception as e: + except Exception: redirect = reverse(INDEX_URL) - msg = _('Unable to update policy: %s') % e + msg = _('Unable to update policy.') exceptions.handle(request, msg, redirect=redirect) return False diff --git a/senlin_dashboard/cluster/policies/views.py b/senlin_dashboard/cluster/policies/views.py index c8c6f6a2..01c31652 100644 --- a/senlin_dashboard/cluster/policies/views.py +++ b/senlin_dashboard/cluster/policies/views.py @@ -57,10 +57,10 @@ class IndexView(tables.DataTableView): paginate=True, reversed_order=reversed_order, filters=filters) - except Exception as e: + except Exception: self._prev = self._more = False policies = [] - msg = _('Unable to retrieve policies: %s') % e + msg = _('Unable to retrieve policies.') exceptions.handle(self.request, msg) return policies @@ -90,8 +90,8 @@ class DetailView(tabs.TabView): policy = senlin.policy_get(self.request, policy_id) policy.policy_spec = yaml.safe_dump(policy.spec, default_flow_style=False) - except Exception as e: - msg = _("Unable to retrieve policy: %s") % e + except Exception: + msg = _("Unable to retrieve policy.") url = reverse_lazy(policies_forms.INDEX_URL) exceptions.handle(self.request, msg, redirect=url) return policy @@ -129,8 +129,8 @@ class UpdateView(forms.ModalFormView): policy = senlin.policy_get(self.request, policy_id) policy_dict = {"policy_id": policy_id, "name": policy.name} - except Exception as e: - msg = _("Unable to retrieve policy: %s") % e + except Exception: + msg = _("Unable to retrieve policy.") url = reverse_lazy(policies_forms.INDEX_URL) exceptions.handle(self.request, msg, redirect=url) return policy_dict diff --git a/senlin_dashboard/cluster/receivers/forms.py b/senlin_dashboard/cluster/receivers/forms.py index a3ce1f05..bdbdf8b5 100644 --- a/senlin_dashboard/cluster/receivers/forms.py +++ b/senlin_dashboard/cluster/receivers/forms.py @@ -95,8 +95,8 @@ class CreateReceiverForm(forms.SelfHandlingForm): _('Your receiver %s has been created successfully.') % data['name']) return receiver - except Exception as e: + except Exception: redirect = reverse(INDEX_URL) - msg = _('Unable to create new receiver: %s') % e + msg = _('Unable to create new receiver.') exceptions.handle(request, msg, redirect=redirect) return False diff --git a/senlin_dashboard/cluster/receivers/views.py b/senlin_dashboard/cluster/receivers/views.py index 54344fcc..5b606e25 100644 --- a/senlin_dashboard/cluster/receivers/views.py +++ b/senlin_dashboard/cluster/receivers/views.py @@ -55,10 +55,10 @@ class IndexView(tables.DataTableView): paginate=True, reversed_order=reversed_order, filters=filters) - except Exception as e: + except Exception: self._prev = self._more = False receivers = [] - msg = _('Unable to retrieve receivers: %s') % e + msg = _('Unable to retrieve receivers.') exceptions.handle(self.request, msg) return receivers @@ -87,8 +87,8 @@ class DetailView(tabs.TabView): # Get initial receiver information receiver_id = self.kwargs["receiver_id"] receiver = senlin.receiver_get(self.request, receiver_id) - except Exception as e: - msg = _("Unable to retrieve receiver: %s") % e + except Exception: + msg = _("Unable to retrieve receiver.") url = reverse_lazy("horizon:cluster:receivers:index") exceptions.handle(self.request, msg, redirect=url) return receiver