Merge "Use for loop instead of map to modify iterables"

This commit is contained in:
Zuul 2018-03-19 06:43:49 +00:00 committed by Gerrit Code Review
commit a8c55fc0fc
3 changed files with 6 additions and 4 deletions

View File

@ -86,7 +86,8 @@ class IndexView(horizon_tables.DataTableView):
msg = _('Unable to retrieve database clusters.')
exceptions.handle(self.request, msg)
map(self._extra_data, clusters)
for cluster in clusters:
self._extra_data(cluster)
return clusters

View File

@ -113,8 +113,8 @@ class DatabaseTab(tabs.TableTab):
instance = self.tab_group.kwargs['instance']
try:
data = api.trove.database_list(self.request, instance.id)
add_instance = lambda d: setattr(d, 'instance', instance)
map(add_instance, data)
for database in data:
setattr(database, 'instance', instance)
except Exception:
msg = _('Unable to get databases data.')
exceptions.handle(self.request, msg)

View File

@ -80,7 +80,8 @@ class IndexView(horizon_tables.DataTableView):
instances = []
msg = _('Unable to retrieve database instances.')
exceptions.handle(self.request, msg)
map(self._extra_data, instances)
for instance in instances:
self._extra_data(instance)
return instances