From 4f5171d2cedb32fdc5a59d241e7ae91c7284b75c Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Fri, 19 Jun 2015 13:24:34 +0000 Subject: [PATCH] Python3: do not use '+' on dict_items objects In Python 3, dict.items() returns an iterator. Iterators cannot be added. Blueprint: neutron-python3 Change-Id: I487178ebceae9946cb53dea1e847d7715f4577f3 --- neutron/extensions/securitygroup.py | 4 ++-- neutron/tests/unit/agent/linux/test_iptables_firewall.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/neutron/extensions/securitygroup.py b/neutron/extensions/securitygroup.py index a772be569..cff13351b 100644 --- a/neutron/extensions/securitygroup.py +++ b/neutron/extensions/securitygroup.py @@ -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 {} diff --git a/neutron/tests/unit/agent/linux/test_iptables_firewall.py b/neutron/tests/unit/agent/linux/test_iptables_firewall.py index 7491d5a87..c2619add2 100644 --- a/neutron/tests/unit/agent/linux/test_iptables_firewall.py +++ b/neutron/tests/unit/agent/linux/test_iptables_firewall.py @@ -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]) -- 2.45.2