diff options
author | Akihiro Motoki <amotoki@gmail.com> | 2020-09-15 14:08:17 +0900 |
---|---|---|
committer | Akihiro Motoki <amotoki@gmail.com> | 2020-10-15 14:37:20 +0900 |
commit | e5d09edc205d70ffc315b5f0ae687b356f0833b9 (patch) | |
tree | 6358a96c95ce61c3100a09d48a89aabb4b8882f2 /openstack_dashboard/dashboards/project/routers/views.py | |
parent | 74df97f57cbc4d69e34b5bf2ee20a9836c929dc9 (diff) | |
download | horizon-e5d09edc205d70ffc315b5f0ae687b356f0833b9.tar.gz |
Use python3-style super()
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.
pylint provides a check for this.
Let's enable 'super-with-arguments' check.
NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.
Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
Diffstat (limited to 'openstack_dashboard/dashboards/project/routers/views.py')
-rw-r--r-- | openstack_dashboard/dashboards/project/routers/views.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/openstack_dashboard/dashboards/project/routers/views.py b/openstack_dashboard/dashboards/project/routers/views.py index c43e985ae..614211ac3 100644 --- a/openstack_dashboard/dashboards/project/routers/views.py +++ b/openstack_dashboard/dashboards/project/routers/views.py @@ -146,7 +146,7 @@ class DetailView(tabs.TabbedTableView): return ports def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) router = self._get_data() table = rtables.RoutersTable(self.request) @@ -181,7 +181,7 @@ class CreateView(forms.ModalFormView): submit_url = reverse_lazy("horizon:project:routers:create") def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['enable_snat_allowed'] = self.initial['enable_snat_allowed'] return context @@ -189,7 +189,7 @@ class CreateView(forms.ModalFormView): enable_snat_allowed = api.neutron.get_feature_permission( self.request, 'ext-gw-mode', 'create_router_enable_snat') self.initial['enable_snat_allowed'] = enable_snat_allowed - return super(CreateView, self).get_initial() + return super().get_initial() class UpdateView(forms.ModalFormView): @@ -202,7 +202,7 @@ class UpdateView(forms.ModalFormView): submit_url = "horizon:project:routers:update" def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['router_id'],) context["router_id"] = self.kwargs['router_id'] context['submit_url'] = reverse(self.submit_url, args=args) |