python3: replace basestring by six.string_types (#40012)
This commit is contained in:
parent
df83160f7e
commit
31a116ccc9
|
@ -19,6 +19,7 @@ import json
|
|||
from django import forms
|
||||
from django.core import validators
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils import six
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from authentic2.a2_rbac.models import RoleAttribute, Role
|
||||
|
@ -43,7 +44,7 @@ class CommaSeparatedInput(forms.TextInput):
|
|||
def _format_value(self, value):
|
||||
if not value:
|
||||
return ''
|
||||
if not isinstance(value, basestring):
|
||||
if not isinstance(value, six.string_types):
|
||||
return u', '.join(value)
|
||||
return value
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ from django.core.management import call_command
|
|||
from django.db import connection
|
||||
from django.db.models import Max
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils import six
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
from django.utils.text import slugify
|
||||
|
||||
|
@ -77,7 +78,7 @@ class Command(BaseCommand):
|
|||
for step in recipe.get('steps', []):
|
||||
action, action_args = list(step.items())[0]
|
||||
for arg in action_args:
|
||||
if not isinstance(action_args[arg], basestring):
|
||||
if not isinstance(action_args[arg], six.string_types):
|
||||
continue
|
||||
action_args[arg] = string.Template(
|
||||
action_args[arg]).substitute(variables)
|
||||
|
|
|
@ -18,6 +18,7 @@ import json
|
|||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils import six
|
||||
|
||||
|
||||
def get_themes():
|
||||
|
@ -61,7 +62,7 @@ def set_theme(theme_id):
|
|||
theme_variable, created = Variable.objects.get_or_create(
|
||||
name=variable, service_pk__isnull=True)
|
||||
theme_variable.auto = True
|
||||
if isinstance(theme['variables'][variable], basestring):
|
||||
if isinstance(theme['variables'][variable], six.string_types):
|
||||
theme_variable.value = theme['variables'][variable]
|
||||
else:
|
||||
theme_variable.value = json.dumps(theme['variables'][variable])
|
||||
|
|
Loading…
Reference in New Issue