Merge "Python3: do not use urllib.urlencode"

This commit is contained in:
Jenkins 2015-07-03 08:35:43 +00:00 committed by Gerrit Code Review
commit f3fe4c22f5
7 changed files with 23 additions and 15 deletions

View File

@ -14,11 +14,11 @@
# under the License.
import functools
import urllib
from oslo_config import cfg
from oslo_log import log as logging
import six
from six.moves.urllib import parse
from webob import exc
from neutron.common import constants
@ -60,7 +60,7 @@ def get_previous_link(request, items, id_key):
marker = items[0][id_key]
params['marker'] = marker
params['page_reverse'] = True
return "%s?%s" % (request.path_url, urllib.urlencode(params))
return "%s?%s" % (request.path_url, parse.urlencode(params))
def get_next_link(request, items, id_key):
@ -70,7 +70,7 @@ def get_next_link(request, items, id_key):
marker = items[-1][id_key]
params['marker'] = marker
params.pop('page_reverse', None)
return "%s?%s" % (request.path_url, urllib.urlencode(params))
return "%s?%s" % (request.path_url, parse.urlencode(params))
def get_limit_and_marker(request):

View File

@ -16,12 +16,12 @@
from six.moves import http_client as httplib
import urllib
import httplib2
from keystoneclient.v2_0 import client as keyclient
from oslo_config import cfg
from oslo_log import log as logging
from six.moves.urllib import parse
from neutron.api.v2 import attributes
from neutron.common import utils
@ -158,7 +158,7 @@ class RequestHandler(object):
serverurl = SDNVE_URL % (controller_ip, self.port, self.base_url)
myurl = serverurl + url
if params and isinstance(params, dict):
myurl += '?' + urllib.urlencode(params, doseq=1)
myurl += '?' + parse.urlencode(params, doseq=1)
try:
LOG.debug("Sending request to SDN-VE. url: "

View File

@ -14,7 +14,8 @@
# under the License.
import json
import urllib
from six.moves.urllib import parse
from neutron.tests.tempest.common import service_client
@ -95,7 +96,7 @@ class IdentityV3ClientJSON(service_client.ServiceClient):
"""Get the list of users."""
url = 'users'
if params:
url += '?%s' % urllib.urlencode(params)
url += '?%s' % parse.urlencode(params)
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
@ -134,7 +135,7 @@ class IdentityV3ClientJSON(service_client.ServiceClient):
def list_projects(self, params=None):
url = "projects"
if params:
url += '?%s' % urllib.urlencode(params)
url += '?%s' % parse.urlencode(params)
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)

View File

@ -14,7 +14,8 @@
# under the License.
import json
import urllib
from six.moves.urllib import parse
from neutron.tests.tempest.common import service_client
@ -64,7 +65,7 @@ class RegionClientJSON(service_client.ServiceClient):
"""List regions."""
url = 'regions'
if params:
url += '?%s' % urllib.urlencode(params)
url += '?%s' % parse.urlencode(params)
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)

View File

@ -12,8 +12,8 @@
import json
import time
import urllib
from six.moves.urllib import parse
from tempest_lib.common.utils import misc
from tempest_lib import exceptions as lib_exc
@ -98,7 +98,7 @@ class NetworkClientJSON(service_client.ServiceClient):
def _list(**filters):
uri = self.get_uri(plural_name)
if filters:
uri += '?' + urllib.urlencode(filters, doseq=1)
uri += '?' + parse.urlencode(filters, doseq=1)
resp, body = self.get(uri)
result = {plural_name: self.deserialize_list(body)}
self.expected_success(200, resp.status)
@ -124,7 +124,7 @@ class NetworkClientJSON(service_client.ServiceClient):
plural = self.pluralize(resource_name)
uri = '%s/%s' % (self.get_uri(plural), resource_id)
if fields:
uri += '?' + urllib.urlencode(fields, doseq=1)
uri += '?' + parse.urlencode(fields, doseq=1)
resp, body = self.get(uri)
body = self.deserialize_single(body)
self.expected_success(200, resp.status)

View File

@ -20,13 +20,13 @@ import os
import re
import sys
import time
import urllib
import uuid
import fixtures
from oslo_log import log as logging
from oslo_utils import importutils
import six
from six.moves.urllib import parse
import testscenarios
import testtools
@ -590,7 +590,7 @@ class NegativeAutoTest(BaseTestCase):
if not json_dict:
return url, None
elif method in ["GET", "HEAD", "PUT", "DELETE"]:
return "%s?%s" % (url, urllib.urlencode(json_dict)), None
return "%s?%s" % (url, parse.urlencode(json_dict)), None
else:
return url, json.dumps(json_dict)

View File

@ -117,6 +117,7 @@ commands = python -m testtools.run \
neutron.tests.unit.plugins.oneconvergence.test_nvsd_agent \
neutron.tests.unit.plugins.oneconvergence.test_plugin_helper \
neutron.tests.unit.plugins.oneconvergence.test_nvsdlib \
neutron.tests.unit.plugins.ibm.test_sdnve_agent \
neutron.tests.unit.plugins.ibm.test_sdnve_api \
neutron.tests.unit.plugins.ml2.test_db \
neutron.tests.unit.plugins.ml2.test_driver_context \
@ -131,6 +132,7 @@ commands = python -m testtools.run \
neutron.tests.unit.plugins.ml2.drivers.mech_fake_agent \
neutron.tests.unit.plugins.ml2.drivers.test_type_vxlan \
neutron.tests.unit.plugins.ml2.drivers.test_type_gre \
neutron.tests.unit.plugins.ml2.drivers.test_helpers \
neutron.tests.unit.plugins.ml2.drivers.arista.test_mechanism_arista \
neutron.tests.unit.plugins.ml2.drivers.test_type_local \
neutron.tests.unit.plugins.ml2.drivers.mechanism_logger \
@ -138,12 +140,14 @@ commands = python -m testtools.run \
neutron.tests.unit.plugins.ml2.drivers.cisco.apic.base \
neutron.tests.unit.plugins.ml2.drivers.cisco.apic.test_apic_topology \
neutron.tests.unit.plugins.ml2.drivers.test_type_flat \
neutron.tests.unit.plugins.ml2.drivers.test_type_vlan \
neutron.tests.unit.plugins.ml2.drivers.mechanism_test \
neutron.tests.unit.plugins.ml2.drivers.l2pop.rpc_manager.l2population_rpc_base \
neutron.tests.unit.plugins.ml2.extensions.fake_extension \
neutron.tests.unit.plugins.ml2.drivers.l2pop.rpc_manager.test_l2population_rpc \
neutron.tests.unit.plugins.cisco.n1kv.fake_client \
neutron.tests.unit.plugins.cisco.test_network_db \
neutron.tests.unit.scheduler.test_dhcp_agent_scheduler \
neutron.tests.unit.db.test_l3_dvr_db \
neutron.tests.unit.db.test_migration \
neutron.tests.unit.db.test_agents_db \
@ -177,8 +181,10 @@ commands = python -m testtools.run \
neutron.tests.unit.agent.linux.test_ipset_manager \
neutron.tests.unit.agent.linux.test_iptables_firewall \
neutron.tests.unit.agent.linux.test_ebtables_manager \
neutron.tests.unit.agent.linux.test_iptables_firewall \
neutron.tests.unit.agent.linux.test_ebtables_driver \
neutron.tests.unit.agent.linux.test_polling \
neutron.tests.unit.agent.linux.test_ip_lib \
neutron.tests.unit.agent.linux.test_ip_monitor \
neutron.tests.unit.agent.linux.test_iptables_manager \
neutron.tests.unit.agent.linux.test_external_process \