mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[py3] Replaced basestring by six.string_types.
This commit is contained in:
@@ -35,10 +35,11 @@ from decimal import Decimal
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.forms import *
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils import six
|
||||
|
||||
|
||||
def fix_os_paths(x):
|
||||
if isinstance(x, basestring):
|
||||
if isinstance(x, six.string_types):
|
||||
return x.replace('\\', '/')
|
||||
elif isinstance(x, tuple):
|
||||
return tuple(fix_os_paths(list(x)))
|
||||
|
||||
@@ -2,13 +2,15 @@ import os
|
||||
import re
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
from django.utils import six
|
||||
|
||||
can_run_extraction_tests = False
|
||||
can_run_compilation_tests = False
|
||||
|
||||
def find_command(cmd, path=None, pathext=None):
|
||||
if path is None:
|
||||
path = os.environ.get('PATH', []).split(os.pathsep)
|
||||
if isinstance(path, basestring):
|
||||
if isinstance(path, six.string_types):
|
||||
path = [path]
|
||||
# check if there are funny path extensions for executables, e.g. Windows
|
||||
if pathext is None:
|
||||
|
||||
@@ -20,6 +20,7 @@ from django.test.utils import override_settings
|
||||
from django.utils.encoding import smart_unicode
|
||||
from django.utils.functional import empty
|
||||
from django.utils._os import rmtree_errorhandler
|
||||
from django.utils import six
|
||||
|
||||
from django.contrib.staticfiles import finders, storage
|
||||
|
||||
@@ -83,7 +84,7 @@ class BaseStaticFilesTestCase(object):
|
||||
self.assertRaises(IOError, self._get_file, filepath)
|
||||
|
||||
def render_template(self, template, **kwargs):
|
||||
if isinstance(template, basestring):
|
||||
if isinstance(template, six.string_types):
|
||||
template = loader.get_template_from_string(template)
|
||||
return template.render(Context(kwargs)).strip()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user