diff --git a/openstack_dashboard/dashboards/admin/overview/views.py b/openstack_dashboard/dashboards/admin/overview/views.py index c0c86332d7..58c0b49f2d 100644 --- a/openstack_dashboard/dashboards/admin/overview/views.py +++ b/openstack_dashboard/dashboards/admin/overview/views.py @@ -64,7 +64,7 @@ class GlobalOverview(usage.UsageView): exceptions.handle(self.request, _('Unable to retrieve project list.')) for instance in data: - project = filter(lambda t: t.id == instance.tenant_id, projects) + project = [t for t in projects if t.id == instance.tenant_id] # If we could not get the project name, show the tenant_id with # a 'Deleted' identifier instead. if project: diff --git a/openstack_dashboard/dashboards/admin/volumes/volumes/tests.py b/openstack_dashboard/dashboards/admin/volumes/volumes/tests.py index f13b41a316..6d5a827c5c 100644 --- a/openstack_dashboard/dashboards/admin/volumes/volumes/tests.py +++ b/openstack_dashboard/dashboards/admin/volumes/volumes/tests.py @@ -89,8 +89,8 @@ class VolumeViewTests(test.BaseAdminViewTests): 'volume_get')}) def test_unmanage_volume(self): # important - need to get the v2 cinder volume which has host data - volume_list = \ - filter(lambda x: x.name == 'v2_volume', self.cinder_volumes.list()) + volume_list = [x for x in self.cinder_volumes.list() + if x.name == 'v2_volume'] volume = volume_list[0] formData = {'volume_name': volume.name, 'host_name': 'host@backend-name#pool', diff --git a/openstack_dashboard/dashboards/project/access_and_security/security_groups/tables.py b/openstack_dashboard/dashboards/project/access_and_security/security_groups/tables.py index 14136eac9b..19f4a8b93a 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/security_groups/tables.py +++ b/openstack_dashboard/dashboards/project/access_and_security/security_groups/tables.py @@ -251,10 +251,10 @@ def check_rule_template(port, ip_proto): rules_dict = getattr(settings, 'SECURITY_GROUP_RULES', {}) if not rules_dict: return port - templ_rule = filter(lambda rule: str(port) == rule['from_port'] - and str(port) == rule['to_port'] - and ip_proto == rule['ip_protocol'], - [rule for rule in rules_dict.values()]) + templ_rule = [rule for rule in rules_dict.values() + if (str(port) == rule['from_port'] + and str(port) == rule['to_port'] + and ip_proto == rule['ip_protocol'])] if templ_rule: return u"%(from_port)s (%(name)s)" % templ_rule[0] return port diff --git a/openstack_dashboard/usage/quotas.py b/openstack_dashboard/usage/quotas.py index a8c81c32ac..aafa6c22bc 100644 --- a/openstack_dashboard/usage/quotas.py +++ b/openstack_dashboard/usage/quotas.py @@ -314,7 +314,7 @@ def _get_tenant_network_usages(request, usages, disabled_quotas, tenant_id): networks = [] networks = neutron.network_list(request, shared=False) if tenant_id: - networks = filter(lambda net: net.tenant_id == tenant_id, networks) + networks = [net for net in networks if net.tenant_id == tenant_id] usages.tally('networks', len(networks)) if 'subnet' not in disabled_quotas: diff --git a/tox.ini b/tox.ini index 9072cb1045..11c62dd535 100644 --- a/tox.ini +++ b/tox.ini @@ -34,6 +34,7 @@ commands = horizon.test.tests.utils \ horizon.test.tests.views python manage.py test --settings=openstack_dashboard.test.settings \ + openstack_dashboard.dashboards.admin.volumes.volumes.tests \ openstack_dashboard.dashboards.identity.users \ openstack_dashboard.dashboards.project.access_and_security.api_access.tests \ openstack_dashboard.dashboards.project.images.images.tests.CreateImageFormTests \