Merge "Python3: use six.moves.urllib.parse.quote instead of urllib.quote"

This commit is contained in:
Jenkins
2014-02-11 08:03:27 +00:00
committed by Gerrit Code Review

View File

@@ -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