Removed template.loader.BaseLoader per deprecation timeline.
This commit is contained in:
parent
2a20ebe6a5
commit
4811f09fa3
|
@ -1,8 +1,5 @@
|
|||
import warnings
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils import lru_cache, six
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.module_loading import import_string
|
||||
|
||||
|
@ -122,16 +119,7 @@ class Engine(object):
|
|||
|
||||
if isinstance(loader, six.string_types):
|
||||
loader_class = import_string(loader)
|
||||
|
||||
if getattr(loader_class, '_accepts_engine_in_init', False):
|
||||
args.insert(0, self)
|
||||
else:
|
||||
warnings.warn(
|
||||
"%s inherits from django.template.loader.BaseLoader "
|
||||
"instead of django.template.loaders.base.Loader. " %
|
||||
loader, RemovedInDjango110Warning, stacklevel=2)
|
||||
|
||||
return loader_class(*args)
|
||||
return loader_class(self, *args)
|
||||
else:
|
||||
raise ImproperlyConfigured(
|
||||
"Invalid value in template loaders configuration: %r" % loader)
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import warnings
|
||||
|
||||
from django.utils.deprecation import RemovedInDjango110Warning
|
||||
|
||||
from . import engines
|
||||
from .exceptions import TemplateDoesNotExist
|
||||
from .loaders import base
|
||||
|
||||
|
||||
def get_template(template_name, using=None):
|
||||
|
@ -62,14 +57,3 @@ def render_to_string(template_name, context=None, request=None, using=None):
|
|||
|
||||
def _engine_list(using=None):
|
||||
return engines.all() if using is None else [engines[using]]
|
||||
|
||||
|
||||
class BaseLoader(base.Loader):
|
||||
_accepts_engine_in_init = False
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
warnings.warn(
|
||||
"django.template.loader.BaseLoader was superseded by "
|
||||
"django.template.loaders.base.Loader.",
|
||||
RemovedInDjango110Warning, stacklevel=2)
|
||||
super(BaseLoader, self).__init__(*args, **kwargs)
|
||||
|
|
|
@ -6,8 +6,6 @@ from django.utils.inspect import func_supports_parameter
|
|||
|
||||
|
||||
class Loader(object):
|
||||
# Only used to raise a deprecation warning. Remove in Django 1.10.
|
||||
_accepts_engine_in_init = True
|
||||
|
||||
def __init__(self, engine):
|
||||
self.engine = engine
|
||||
|
|
|
@ -968,11 +968,6 @@ loaders. Custom ``Loader`` classes should inherit from
|
|||
``django.template.loaders.base.Loader`` and define the ``get_contents()`` and
|
||||
``get_template_sources()`` methods.
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
``django.template.loaders.base.Loader`` used to be defined at
|
||||
``django.template.loader.BaseLoader``.
|
||||
|
||||
.. versionchanged:: 1.9
|
||||
|
||||
In previous versions of Django, custom loaders defined a single method:
|
||||
|
|
Loading…
Reference in New Issue