Keep py3.X compatibility for urllib
Use six.moves.urllib.parse instead of urllib Closes-Bug: #1280105 Change-Id: I861c32fe7333c3d30b5ae395c97df16f6b39f778
This commit is contained in:
parent
cfffe1ebef
commit
f707fa6189
|
@ -15,7 +15,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import urllib
|
import six.moves.urllib.parse as urlparse
|
||||||
|
|
||||||
from web.httpserver import StaticApp
|
from web.httpserver import StaticApp
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class NailgunStaticApp(StaticApp):
|
||||||
path = path.split('?', 1)[0].split('#', 1)[0]
|
path = path.split('?', 1)[0].split('#', 1)[0]
|
||||||
if path.startswith("/static/"):
|
if path.startswith("/static/"):
|
||||||
path = path[7:]
|
path = path[7:]
|
||||||
path = os.path.normpath(urllib.unquote(path))
|
path = os.path.normpath(urlparse.unquote(path))
|
||||||
words = path.split('/')
|
words = path.split('/')
|
||||||
words = filter(None, words)
|
words = filter(None, words)
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class StaticMiddleware(object):
|
||||||
return self.app(environ, start_response)
|
return self.app(environ, start_response)
|
||||||
|
|
||||||
def normpath(self, path):
|
def normpath(self, path):
|
||||||
path2 = os.path.normpath(urllib.unquote(path))
|
path2 = os.path.normpath(urlparse.unquote(path))
|
||||||
if path.endswith("/"):
|
if path.endswith("/"):
|
||||||
path2 += "/"
|
path2 += "/"
|
||||||
return path2
|
return path2
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import urllib
|
import six.moves.urllib.parse as urlparse
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
|
@ -346,4 +346,4 @@ class TestOpenstackConfigHandlers(BaseIntegrationTest):
|
||||||
def _make_filter_url(cls, **kwargs):
|
def _make_filter_url(cls, **kwargs):
|
||||||
return '{0}?{1}'.format(
|
return '{0}?{1}'.format(
|
||||||
reverse('OpenstackConfigCollectionHandler'),
|
reverse('OpenstackConfigCollectionHandler'),
|
||||||
urllib.urlencode(kwargs))
|
urlparse.urlencode(kwargs))
|
||||||
|
|
Loading…
Reference in New Issue