]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Python3: do not use '+' on dict_items objects
authorCyril Roelandt <cyril@redhat.com>
Fri, 19 Jun 2015 13:24:34 +0000 (13:24 +0000)
committerCyril Roelandt <cyril@redhat.com>
Fri, 19 Jun 2015 13:57:39 +0000 (15:57 +0200)
In Python 3, dict.items() returns an iterator. Iterators cannot be added.

Blueprint: neutron-python3
Change-Id: I487178ebceae9946cb53dea1e847d7715f4577f3

neutron/extensions/securitygroup.py
neutron/tests/unit/agent/linux/test_iptables_firewall.py

index a772be5692f1c2481bbc5c902ee50ea4fe780f29..cff13351b279077b8a75a3226614f26108802101 100644 (file)
@@ -326,8 +326,8 @@ class Securitygroup(extensions.ExtensionDescriptor):
 
     def get_extended_resources(self, version):
         if version == "2.0":
-            return dict(EXTENDED_ATTRIBUTES_2_0.items() +
-                        RESOURCE_ATTRIBUTE_MAP.items())
+            return dict(list(EXTENDED_ATTRIBUTES_2_0.items()) +
+                        list(RESOURCE_ATTRIBUTE_MAP.items()))
         else:
             return {}
 
index 7491d5a8740b49ea7ff44f75994c393ac44ef380..c2619add2e6652934262c797baa38a898f2857e6 100644 (file)
@@ -1672,7 +1672,7 @@ class IptablesFirewallEnhancedIpsetTestCase(BaseIptablesFirewallTestCase):
         rules = self.firewall._expand_sg_rule_with_remote_ips(
             rule, port, 'ingress')
         self.assertEqual(list(rules),
-                         [dict(rule.items() +
+                         [dict(list(rule.items()) +
                                [('source_ip_prefix', '%s/32' % ip)])
                           for ip in other_ips])