Update urllib/urlparse to use six.moves

Partially-Implements: blueprint designate-py3

Change-Id: I63ba1c2dc570a3b1f5d470807578e041be6fd26b
This commit is contained in:
Pradeep Kumar Singh 2015-06-30 07:55:50 +05:30
parent 77783cb377
commit df97afd2f6
5 changed files with 12 additions and 15 deletions

View File

@ -13,8 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import urllib
from six.moves.urllib import parse
from oslo_config import cfg
from oslo_log import log as logging
@ -163,7 +162,7 @@ class BaseView(object):
base_href = self._get_base_href(parents)
href = "%s?%s" % (base_href, urllib.urlencode(params))
href = "%s?%s" % (base_href, parse.urlencode(params))
return href.rstrip('?')

View File

@ -17,9 +17,8 @@
import json as jsonutils
import logging
import urllib
import urlparse
from six.moves.urllib import parse
import requests
from designate.backend.impl_infoblox.config import cfg
@ -86,9 +85,9 @@ class Infoblox(object):
if query_params:
if len(query) > 1:
query += '&'
query += urllib.urlencode(query_params)
query += parse.urlencode(query_params)
baseurl = urlparse.urljoin(self.wapi_url, urllib.quote(relative_path))
baseurl = parse.urljoin(self.wapi_url, parse.quote(relative_path))
return baseurl + query
def _validate_objtype_or_die(self, objtype):

View File

@ -11,8 +11,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import urllib
from six.moves.urllib import parse
from oslo_log import log as logging
from oslo_config import cfg
@ -123,7 +122,7 @@ class APIv2Adapter(base.DesignateAdapter):
href = "%s%s?%s" % (
cls.BASE_URI,
cls._get_path(request),
urllib.urlencode(params))
parse.urlencode(params))
return href.rstrip('?')

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import copy
import urlparse
import six
from six.moves.urllib import parse
import jsonschema
from oslo_log import log as logging
@ -78,7 +78,7 @@ def _schema_ref_resolver(uri):
Sample URI: obj://ObjectName#/subpathA/subpathB
"""
obj_name = urlparse.urlsplit(uri).netloc
obj_name = parse.urlsplit(uri).netloc
obj = DesignateObject.obj_cls_from_name(obj_name)
return obj.obj_get_schema()

View File

@ -15,9 +15,9 @@ limitations under the License.
"""
import copy
import urlparse
import re
from six.moves.urllib import parse
from tempest_lib.auth import AuthProvider
@ -45,9 +45,9 @@ class NoAuthAuthProvider(AuthProvider):
else:
# Join base URL and url, and remove multiple contiguous slashes
_url = "/".join([base_url, url])
parts = [x for x in urlparse.urlparse(_url)]
parts = [x for x in parse.urlparse(_url)]
parts[2] = re.sub("/{2,}", "/", parts[2])
_url = urlparse.urlunparse(parts)
_url = parse.urlunparse(parts)
# no change to method or body
return str(_url), _headers, body