mirror of
https://github.com/django/django.git
synced 2025-10-30 17:16:10 +00:00
[py3] Replaced basestring by six.string_types.
This commit is contained in:
@@ -18,6 +18,7 @@ from django.utils.safestring import (SafeData, EscapeData, mark_safe,
|
||||
from django.utils.formats import localize
|
||||
from django.utils.html import escape
|
||||
from django.utils.module_loading import module_has_submodule
|
||||
from django.utils import six
|
||||
from django.utils.timezone import template_localtime
|
||||
|
||||
|
||||
@@ -1188,7 +1189,7 @@ class Library(object):
|
||||
from django.template.loader import get_template, select_template
|
||||
if isinstance(file_name, Template):
|
||||
t = file_name
|
||||
elif not isinstance(file_name, basestring) and is_iterable(file_name):
|
||||
elif not isinstance(file_name, six.string_types) and is_iterable(file_name):
|
||||
t = select_template(file_name)
|
||||
else:
|
||||
t = get_template(file_name)
|
||||
|
||||
@@ -29,6 +29,7 @@ from django.core.exceptions import ImproperlyConfigured
|
||||
from django.template.base import Origin, Template, Context, TemplateDoesNotExist, add_to_builtins
|
||||
from django.utils.importlib import import_module
|
||||
from django.conf import settings
|
||||
from django.utils import six
|
||||
|
||||
template_source_loaders = None
|
||||
|
||||
@@ -89,7 +90,7 @@ def find_template_loader(loader):
|
||||
loader, args = loader[0], loader[1:]
|
||||
else:
|
||||
args = []
|
||||
if isinstance(loader, basestring):
|
||||
if isinstance(loader, six.string_types):
|
||||
module, attr = loader.rsplit('.', 1)
|
||||
try:
|
||||
mod = import_module(module)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from django.http import HttpResponse
|
||||
from django.template import loader, Context, RequestContext
|
||||
from django.utils import six
|
||||
|
||||
|
||||
class ContentNotRenderedError(Exception):
|
||||
@@ -53,7 +54,7 @@ class SimpleTemplateResponse(HttpResponse):
|
||||
"Accepts a template object, path-to-template or list of paths"
|
||||
if isinstance(template, (list, tuple)):
|
||||
return loader.select_template(template)
|
||||
elif isinstance(template, basestring):
|
||||
elif isinstance(template, six.string_types):
|
||||
return loader.get_template(template)
|
||||
else:
|
||||
return template
|
||||
|
||||
Reference in New Issue
Block a user