summaryrefslogtreecommitdiff
path: root/glance_store/backend.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2015-05-20 11:29:30 -0700
committerVictor Stinner <vstinner@redhat.com>2015-05-20 12:47:02 -0700
commite6d19f151f8f7c9729af44fbc88ee6d5babafc3a (patch)
tree9c39fa780075f2eafab77fb960f789b97705bdd7 /glance_store/backend.py
parent7f6a18b041eba88133db7ac5518cb2163bee7e03 (diff)
downloadglance_store-e6d19f151f8f7c9729af44fbc88ee6d5babafc3a.tar.gz
Fix Python 3 issues
* Replace it.next() with next(it) * Replace dict.iteritems() with six.iteritems(dict) * Replace unicode with six.text_type * Replace dict(d1.items() + {'Cookie': cookie}.items()) with: d3=dict(d1); d3['Cookie'] = cookie * Replace map(func, parts) with [func(part) for part in parts] * Open file in binary mode (not in text mode) to load JSON using jsonutils.load() * Avoid using dict.keys()[0] or dict.values()[0]: on Python 3, keys() and values() methods of dictionaries return iterators, not lists For more information on Python 3, see: https://wiki.openstack.org/wiki/Python3 Change-Id: Ib09a3367d8dcb664911a0b187da9e363a96727fd
Diffstat (limited to 'glance_store/backend.py')
-rw-r--r--glance_store/backend.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/glance_store/backend.py b/glance_store/backend.py
index 916b3d7..df22729 100644
--- a/glance_store/backend.py
+++ b/glance_store/backend.py
@@ -16,6 +16,7 @@
import logging
from oslo_config import cfg
+import six
from stevedore import driver
from stevedore import extension
@@ -311,7 +312,7 @@ def check_location_metadata(val, key=''):
for v in val:
check_location_metadata(v, key='%s[%d]' % (key, ndx))
ndx = ndx + 1
- elif not isinstance(val, unicode):
+ elif not isinstance(val, six.text_type):
raise exceptions.BackendException(_("The image metadata key %(key)s "
"has an invalid type of %(type)s. "
"Only dict, list, and unicode are "