Fix py3 compatibilty issues

1. replace urllib with six.moves.urllib
2. replace basestring with six.string_types

Change-Id: I92dbbdb149ed35e1623184eb7a93162b5cc0bfb6
This commit is contained in:
Pradeep Kumar Singh 2015-07-23 13:51:13 +09:00
parent 97ae902a8d
commit a0eafcb093
2 changed files with 6 additions and 4 deletions

View File

@ -15,9 +15,9 @@
# under the License. # under the License.
import abc import abc
import json import json
from urllib import urlencode
import six import six
from six.moves.urllib import parse
from stevedore import extension from stevedore import extension
from designateclient import exceptions from designateclient import exceptions
@ -37,7 +37,7 @@ class Controller(object):
if limit is not None: if limit is not None:
params['limit'] = limit params['limit'] = limit
q = urlencode(params) if params else '' q = parse.urlencode(params) if params else ''
return '%(url)s%(params)s' % { return '%(url)s%(params)s' % {
'url': url, 'url': url,
'params': '?%s' % q 'params': '?%s' % q

View File

@ -14,6 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo_utils import uuidutils from oslo_utils import uuidutils
import six
from designateclient import client from designateclient import client
from designateclient.v2 import utils as v2_utils from designateclient.v2 import utils as v2_utils
@ -24,7 +25,8 @@ class RecordSetController(client.Controller):
zone_info = None zone_info = None
# If we get a zone name we'll need to get the ID of it before POST. # If we get a zone name we'll need to get the ID of it before POST.
if isinstance(zone, basestring) and not uuidutils.is_uuid_like(zone): if isinstance(zone, six.string_types) and not \
uuidutils.is_uuid_like(zone):
zone_info = self.client.zones.get(zone) zone_info = self.client.zones.get(zone)
elif isinstance(zone, dict): elif isinstance(zone, dict):
zone_info = zone zone_info = zone