py3: Replace basestring with six.string_types

Patch generated by the command:

  sixer.py basestring horizon/ openstack_dashboard/ tools/

Partial-Implements: blueprint porting-python3
Change-Id: I6fd251243a058457f69907eb1111f559a224e1cb
This commit is contained in:
Victor Stinner 2015-08-19 16:16:29 -07:00
parent be746bca4e
commit 27e3f6c537
4 changed files with 5 additions and 4 deletions

View File

@ -15,6 +15,7 @@
import re
import netaddr
import six
from django.core.exceptions import ValidationError # noqa
from django.core import urlresolvers
@ -189,7 +190,7 @@ class SelectWidget(widgets.Select):
html_attrs = self.transform_html_attrs(option_label)
other_html += flatatt(html_attrs)
if not isinstance(option_label, (basestring, Promise)):
if not isinstance(option_label, (six.string_types, Promise)):
for data_attr in self.data_attrs:
data_value = html.conditional_escape(
force_text(getattr(option_label,

View File

@ -753,7 +753,7 @@ class BatchAction(Action):
action_attr = getattr(self, "action_%s" % action_type)
if self.use_action_method:
action_attr = action_attr(count)
if isinstance(action_attr, (basestring, Promise)):
if isinstance(action_attr, (six.string_types, Promise)):
action = action_attr
else:
toggle_selection = getattr(self, "current_%s_action" % action_type)

View File

@ -318,7 +318,7 @@ class Step(object):
# If it's callable we know the function exists and is valid
self._handlers[key].append(possible_handler)
continue
elif not isinstance(possible_handler, basestring):
elif not isinstance(possible_handler, six.string_types):
raise TypeError("Connection handlers must be either "
"callables or strings.")
bits = possible_handler.split(".")

View File

@ -136,7 +136,7 @@ def resource_to_url(resource):
def stack_output(output):
if not output:
return u''
if isinstance(output, basestring):
if isinstance(output, six.string_types):
parts = urlparse.urlsplit(output)
if parts.netloc and parts.scheme in ('http', 'https'):
url = html.escape(output)