From 88ae6c20c52e20298b8e778f87bd560d1a2bb3c4 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Mon, 10 Feb 2014 01:41:41 +0100 Subject: [PATCH] Python3: use six.moves.urllib.parse.quote instead of urllib.quote This makes the code compatible with both python 2 and 3. Change-Id: Ic1c5c8d4a85db138a8402ea4b3208828fc118a40 --- keystoneclient/middleware/s3_token.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keystoneclient/middleware/s3_token.py b/keystoneclient/middleware/s3_token.py index 546fd6aab..72a82e93e 100644 --- a/keystoneclient/middleware/s3_token.py +++ b/keystoneclient/middleware/s3_token.py @@ -34,11 +34,11 @@ This WSGI component: """ import logging -import urllib import webob import requests import six +from six.moves import urllib from keystoneclient.openstack.common import jsonutils @@ -78,7 +78,7 @@ def split_path(path, minsegs=1, maxsegs=None, rest_with_last=False): count = len(segs) if (segs[0] or count < minsegs or count > maxsegs or '' in segs[1:minsegs]): - raise ValueError('Invalid path: %s' % urllib.quote(path)) + raise ValueError('Invalid path: %s' % urllib.parse.quote(path)) else: minsegs += 1 maxsegs += 1 @@ -87,7 +87,7 @@ def split_path(path, minsegs=1, maxsegs=None, rest_with_last=False): if (segs[0] or count < minsegs or count > maxsegs + 1 or '' in segs[1:minsegs] or (count == maxsegs + 1 and segs[maxsegs])): - raise ValueError('Invalid path: %s' % urllib.quote(path)) + raise ValueError('Invalid path: %s' % urllib.parse.quote(path)) segs = segs[1:maxsegs] segs.extend([None] * (maxsegs - 1 - len(segs))) return segs