Merge "Fix the compatible issues related to filter function in stx-gui"

This commit is contained in:
Zuul 2018-10-22 12:48:03 +00:00 committed by Gerrit Code Review
commit b273d3d59d
5 changed files with 15 additions and 16 deletions

View File

@ -497,15 +497,14 @@ class AddInterface(forms.SelfHandlingForm):
cleaned_data.pop('ipv6_pool', None)
if ifclass == 'data':
providernetworks = filter(
None, cleaned_data.get('providernetworks_data', []))
providernetworks = [_f for _f in cleaned_data.get(
'providernetworks_data', []) if _f]
elif ifclass == 'pci-passthrough':
providernetworks = filter(None, cleaned_data.get(
'providernetworks_pci', []))
providernetworks = [_f for _f in cleaned_data.get(
'providernetworks_pci', []) if _f]
elif ifclass == 'pci-sriov':
providernetworks = filter(
None,
cleaned_data.get('providernetworks_sriov', []))
providernetworks = [_f for _f in cleaned_data.get(
'providernetworks_sriov', []) if _f]
else:
providernetworks = []

View File

@ -362,7 +362,7 @@ class SensorsFilterAction(tables.FilterAction):
return True
return False
return filter(comp, sensors)
return list(filter(comp, sensors))
class SensorsTable(tables.DataTable):

View File

@ -590,7 +590,7 @@ class HostsStorageFilterAction(tables.FilterAction):
return True
return False
return filter(comp, hosts)
return list(filter(comp, hosts))
class HostsComputeFilterAction(tables.FilterAction):
@ -675,10 +675,10 @@ def get_task_or_status(host):
patch_state = ""
return _("%s") % "<br />".join(
filter(None, [task_or_status,
patch_current,
reboot_required,
patch_state]))
[_f for _f in [task_or_status,
patch_current,
reboot_required,
patch_state] if _f])
TASK_STATE_CHOICES = (

View File

@ -152,7 +152,7 @@ class PatchFilterAction(tables.FilterAction):
return True
return False
return filter(comp, patches)
return list(filter(comp, patches))
class PatchesTable(tables.DataTable):

View File

@ -56,9 +56,9 @@ class DetailPatchView(views.HorizonTemplateView):
try:
patch = stx_api.patch.get_patch(self.request, patch_id)
patch.contents_display = "%s" % "\n".join(
filter(None, patch.contents))
[_f for _f in patch.contents if _f])
patch.requires_display = "%s" % "\n".join(
filter(None, patch.requires))
[_f for _f in patch.requires if _f])
except Exception:
redirect = reverse(self.failure_url)
exceptions.handle(self.request,