From 595788cbdcb81a54e60ac5f63e63053368b6ae23 Mon Sep 17 00:00:00 2001 From: Bo Wang Date: Wed, 13 Jan 2016 13:58:37 +0800 Subject: [PATCH] Fixes Python 3 compatibility for filter results Python 2.7 filter method result was a list, while for Python 3.4 the result is a "filter object". Trying to use it as a list will result in a TypeError. Partial-Implements: blueprint porting-python3 Change-Id: I51836347f259d0223bcfa5cc2ec0b7fbd7a203eb --- horizon/tabs/base.py | 2 +- openstack_dashboard/dashboards/identity/groups/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/horizon/tabs/base.py b/horizon/tabs/base.py index 7a214967e3..48cca738de 100644 --- a/horizon/tabs/base.py +++ b/horizon/tabs/base.py @@ -193,7 +193,7 @@ class TabGroup(html.HTMLElement): return None def get_loaded_tabs(self): - return filter(lambda t: self.get_tab(t.slug), self._tabs.values()) + return [tab for tab in self._tabs.values() if self.get_tab(tab.slug)] def get_selected_tab(self): """Returns the tab specific by the GET request parameter. diff --git a/openstack_dashboard/dashboards/identity/groups/views.py b/openstack_dashboard/dashboards/identity/groups/views.py index 2f0f2d80a6..b312470be0 100644 --- a/openstack_dashboard/dashboards/identity/groups/views.py +++ b/openstack_dashboard/dashboards/identity/groups/views.py @@ -117,7 +117,7 @@ class GroupManageMixin(object): domain=domain_id) group_members = self._get_group_members() group_member_ids = [user.id for user in group_members] - return filter(lambda u: u.id not in group_member_ids, all_users) + return [u for u in all_users if u.id not in group_member_ids] class ManageMembersView(GroupManageMixin, tables.DataTableView):