Replace basestring with six.string_types
https://wiki.openstack.org/wiki/Python3 Change-Id: I09ceb7c4819573f404359af5200e990b1e6070e2
This commit is contained in:
parent
e24a7e7db3
commit
26a42aeddf
@ -21,6 +21,7 @@ from webob import exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from gceapi.api import clients
|
||||
from gceapi.api import operation_api
|
||||
@ -249,7 +250,7 @@ class Controller(object):
|
||||
"""Returns standard format for given date."""
|
||||
if date_string is None:
|
||||
return None
|
||||
if isinstance(date_string, basestring):
|
||||
if isinstance(date_string, six.string_types):
|
||||
date_string = timeutils.parse_isotime(date_string)
|
||||
return date_string.strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
from oslo_context import context
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from gceapi import exception
|
||||
from gceapi.i18n import _
|
||||
@ -72,7 +73,7 @@ class RequestContext(context.RequestContext):
|
||||
self.remote_address = remote_address
|
||||
if not timestamp:
|
||||
timestamp = timeutils.utcnow()
|
||||
if isinstance(timestamp, basestring):
|
||||
if isinstance(timestamp, six.string_types):
|
||||
timestamp = timeutils.parse_strtime(timestamp)
|
||||
self.timestamp = timestamp
|
||||
|
||||
|
@ -32,6 +32,7 @@ import fixtures
|
||||
import mox
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import stubout
|
||||
import testtools
|
||||
|
||||
@ -155,7 +156,7 @@ class TestCase(testtools.TestCase):
|
||||
self.assertIn(k, d2)
|
||||
v2 = d2[k]
|
||||
if(isinstance(v1, collections.Iterable) and
|
||||
not isinstance(v1, basestring)):
|
||||
not isinstance(v1, six.string_types)):
|
||||
self.assertItemsEqual(v1, v2, msg)
|
||||
else:
|
||||
self.assertEqual(v1, v2, msg)
|
||||
|
Loading…
Reference in New Issue
Block a user