Kaydet (Commit) 4811f09f authored tarafından Tim Graham's avatar Tim Graham

Removed template.loader.BaseLoader per deprecation timeline.

üst 2a20ebe6
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)
......
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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment