Python 3: dict.itervalues()

Replace dict.itervalues() with dict.values(). The Python 3 dict
type has no itervalues() method, the old itervalues() method was
renamed to values().

Change-Id: I675daebf4e5b1a24f2ddeec1451b6d95e6a8785e
This commit is contained in:
qinchunhua 2016-07-22 22:25:46 -04:00
parent 4f195b8cf5
commit 478184f0b1
2 changed files with 4 additions and 4 deletions

View File

@ -417,7 +417,7 @@ class ExtensionManager(object):
resources = []
resources.append(ResourceExtension('extensions',
ExtensionController(self)))
for ext in self.extensions.itervalues():
for ext in self.extensions.values():
try:
resources.extend(ext.get_resources())
except AttributeError:
@ -429,7 +429,7 @@ class ExtensionManager(object):
def get_actions(self):
"""Returns a list of ActionExtension objects."""
actions = []
for ext in self.extensions.itervalues():
for ext in self.extensions.values():
try:
actions.extend(ext.get_actions())
except AttributeError:
@ -441,7 +441,7 @@ class ExtensionManager(object):
def get_request_extensions(self):
"""Returns a list of RequestExtension objects."""
request_exts = []
for ext in self.extensions.itervalues():
for ext in self.extensions.values():
try:
request_exts.extend(ext.get_request_extensions())
except AttributeError:

View File

@ -235,7 +235,7 @@ def parse_mappings(mapping_list, unique_values=True):
if key in mappings:
raise ValueError(_("Key %(key)s in mapping: '%(mapping)s' not "
"unique") % {'key': key, 'mapping': mapping})
if unique_values and value in mappings.itervalues():
if unique_values and value in mappings.values():
raise ValueError(_("Value %(value)s in mapping: '%(mapping)s' "
"not unique") % {'value': value,
'mapping': mapping})