From 27e3f6c537b16bf580819d64fed65cec6ef656ae Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 19 Aug 2015 16:16:29 -0700 Subject: [PATCH] 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 --- horizon/forms/fields.py | 3 ++- horizon/tables/actions.py | 2 +- horizon/workflows/base.py | 2 +- openstack_dashboard/dashboards/project/stacks/mappings.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/horizon/forms/fields.py b/horizon/forms/fields.py index fab6b10610..1ffb321db6 100644 --- a/horizon/forms/fields.py +++ b/horizon/forms/fields.py @@ -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, diff --git a/horizon/tables/actions.py b/horizon/tables/actions.py index 4ffef40ab9..f0b7d311de 100644 --- a/horizon/tables/actions.py +++ b/horizon/tables/actions.py @@ -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) diff --git a/horizon/workflows/base.py b/horizon/workflows/base.py index 4a910320f1..9ab692bbe6 100644 --- a/horizon/workflows/base.py +++ b/horizon/workflows/base.py @@ -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(".") diff --git a/openstack_dashboard/dashboards/project/stacks/mappings.py b/openstack_dashboard/dashboards/project/stacks/mappings.py index 6ced28f45f..d5963eef85 100644 --- a/openstack_dashboard/dashboards/project/stacks/mappings.py +++ b/openstack_dashboard/dashboards/project/stacks/mappings.py @@ -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)