diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-03-30 19:48:34 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-03-30 19:48:34 +0000 |
commit | 21db1bf83670f284b8f3d1dab4dc2be548ffb57e (patch) | |
tree | d9e1211568090e94725766e597f4087bdcb00ef3 /swiftclient/client.py | |
parent | e3b7ecd2bbc5120444b3c1643fb89ccd47e454bb (diff) | |
parent | 12f86fdcc57896bac62d36c74a80fd19adeeac58 (diff) | |
download | python-swiftclient-21db1bf83670f284b8f3d1dab4dc2be548ffb57e.tar.gz |
Merge "Python 3: Get compatible types from six"
Diffstat (limited to 'swiftclient/client.py')
-rw-r--r-- | swiftclient/client.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py index 5ebbcf2..2cb54a1 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -28,6 +28,7 @@ from requests.exceptions import RequestException, SSLError from six.moves.urllib.parse import quote as _quote from six.moves.urllib.parse import urlparse, urlunparse from time import sleep, time +import six from swiftclient.exceptions import ClientException, InvalidHeadersException from swiftclient.utils import LengthWrapper @@ -97,7 +98,7 @@ def quote(value, safe='/'): Patched version of urllib.quote that encodes utf8 strings before quoting """ value = encode_utf8(value) - if isinstance(value, str): + if isinstance(value, bytes): return _quote(value, safe) else: return value @@ -117,7 +118,7 @@ def validate_headers(headers): def encode_utf8(value): - if isinstance(value, unicode): + if isinstance(value, six.text_type): value = value.encode('utf8') return value |