diff options
author | Victor Stinner <vstinner@redhat.com> | 2015-05-20 11:53:30 -0700 |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2015-06-10 11:31:44 +0200 |
commit | 65b9489e19ce6c9bf958db471dacf307820050f2 (patch) | |
tree | 4c5d97b1e3519ba6befbcb3b8229f3df19d71b69 /glance_store/common | |
parent | fd8e0b2c547297e6b35784226863812c68774288 (diff) | |
download | glance_store-65b9489e19ce6c9bf958db471dacf307820050f2.tar.gz |
Use six.moves to fix imports on Python 3
* Use six.moves to get builtins, configparser, http_client
and urllib modules
* Replace StringIO.StringIO with six.StringIO
* Replace reload(mod) with moves.reload_module(mod)
Patch generated by the six_moves, stringio and urllib operations of the
sixer tool version 0.4:
https://pypi.python.org/pypi/sixer
Manual changes:
* test_vmware_store: add _mock_http_connection() helper method to
factorize code mocking http_client.HTTPConnection
* Reformat some lines to respect the constraint of 80 columns
* Replace reload() with imp.reload_module()
* Replace httplib with six.moves.http_client in mock.patch()
Change-Id: I5a065c0778436a12db90ac3b929fa840f3e86665
Diffstat (limited to 'glance_store/common')
-rw-r--r-- | glance_store/common/auth.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/glance_store/common/auth.py b/glance_store/common/auth.py index 3cf1a72..7a48da4 100644 --- a/glance_store/common/auth.py +++ b/glance_store/common/auth.py @@ -34,7 +34,7 @@ import logging from oslo_serialization import jsonutils # NOTE(jokke): simplified transition to py3, behaves like py2 xrange from six.moves import range -import six.moves.urllib.parse as urlparse +from six.moves import urllib from glance_store import exceptions @@ -115,7 +115,7 @@ class KeystoneStrategy(BaseStrategy): # If OS_AUTH_URL is missing a trailing slash add one if not auth_url.endswith('/'): auth_url += '/' - token_url = urlparse.urljoin(auth_url, "tokens") + token_url = urllib.parse.urljoin(auth_url, "tokens") # 1. Check Keystone version is_v2 = auth_url.rstrip('/').endswith('v2.0') if is_v2: @@ -136,7 +136,7 @@ class KeystoneStrategy(BaseStrategy): # v2.0 keystone endpoint. Also, new location does not # contain real endpoint, only hostname and port. if 'v2.0' not in auth_url: - auth_url = urlparse.urljoin(auth_url, 'v2.0/') + auth_url = urllib.parse.urljoin(auth_url, 'v2.0/') else: # If we successfully auth'd, then memorize the correct auth_url # for future use. |