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
This commit is contained in:
@@ -34,11 +34,11 @@ This WSGI component:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import urllib
|
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import six
|
import six
|
||||||
|
from six.moves import urllib
|
||||||
|
|
||||||
from keystoneclient.openstack.common import jsonutils
|
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)
|
count = len(segs)
|
||||||
if (segs[0] or count < minsegs or count > maxsegs or
|
if (segs[0] or count < minsegs or count > maxsegs or
|
||||||
'' in segs[1:minsegs]):
|
'' in segs[1:minsegs]):
|
||||||
raise ValueError('Invalid path: %s' % urllib.quote(path))
|
raise ValueError('Invalid path: %s' % urllib.parse.quote(path))
|
||||||
else:
|
else:
|
||||||
minsegs += 1
|
minsegs += 1
|
||||||
maxsegs += 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
|
if (segs[0] or count < minsegs or count > maxsegs + 1 or
|
||||||
'' in segs[1:minsegs] or
|
'' in segs[1:minsegs] or
|
||||||
(count == maxsegs + 1 and segs[maxsegs])):
|
(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 = segs[1:maxsegs]
|
||||||
segs.extend([None] * (maxsegs - 1 - len(segs)))
|
segs.extend([None] * (maxsegs - 1 - len(segs)))
|
||||||
return segs
|
return segs
|
||||||
|
Reference in New Issue
Block a user