Replace dict.iteritems() with dict.items() in horizon
1.As mentioned in [1], we should avoid using dict.iteritems() to achieve iterators. We can use dict.items instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. 2.In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.htmls Change-Id: Idba02079d76b529b344ae96cebb7d6161c0ecbc6
This commit is contained in:
parent
299f4c3562
commit
7adb3f548b
@ -16,7 +16,7 @@
|
||||
</a>
|
||||
<ul id="sidebar-accordion-{{ dashboard.slug }}"
|
||||
class="nav collapse panel-collapse{% if current.slug == dashboard.slug %} in{% endif %}">
|
||||
{% for group, panels in panel_info.iteritems %}
|
||||
{% for group, panels in panel_info.items %}
|
||||
{% with panels|has_permissions_on_list:user as filtered_panels %}
|
||||
{% if filtered_panels %}
|
||||
{% if group.name %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% load horizon %}
|
||||
|
||||
{% for heading, panels in components.iteritems %}
|
||||
{% for heading, panels in components.items %}
|
||||
{% with panels|has_permissions_on_list:user as filtered_panels %}
|
||||
{% if filtered_panels %}
|
||||
{% if accessible_panels %}
|
||||
|
@ -158,7 +158,7 @@ class ImagesPage(basepage.BaseNavigationPage):
|
||||
def add_custom_metadata(self, name, metadata):
|
||||
row = self._get_row_with_image_name(name)
|
||||
update_metadata_form = self.images_table.update_metadata(row)
|
||||
for field_name, value in metadata.iteritems():
|
||||
for field_name, value in metadata.items():
|
||||
update_metadata_form.add_custom_field(field_name, value)
|
||||
update_metadata_form.submit()
|
||||
|
||||
@ -168,7 +168,7 @@ class ImagesPage(basepage.BaseNavigationPage):
|
||||
description_page = self.images_table.go_to_image_description_page(row)
|
||||
content = description_page.get_content()
|
||||
|
||||
for name, value in content.iteritems():
|
||||
for name, value in content.items():
|
||||
if name in dict_with_details:
|
||||
if dict_with_details[name] in value:
|
||||
matches.append(True)
|
||||
|
@ -17,7 +17,7 @@
|
||||
</a>
|
||||
<ul id="sidebar-drawer-{{ dashboard.slug }}"
|
||||
class="nav collapse panel-collapse{% if current.slug == dashboard.slug %} in{% endif %}">
|
||||
{% for group, panels in panel_info.iteritems %}
|
||||
{% for group, panels in panel_info.items %}
|
||||
{% with panels|has_permissions_on_list:user as filtered_panels %}
|
||||
{% if filtered_panels %}
|
||||
{% if group.name %}
|
||||
|
Loading…
Reference in New Issue
Block a user