Removed template.loader.BaseLoader per deprecation timeline.

This commit is contained in:
Tim Graham 2015-09-05 08:37:44 -04:00
parent 2a20ebe6a5
commit 4811f09fa3
4 changed files with 1 additions and 36 deletions

View File

@ -1,8 +1,5 @@
import warnings
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.utils import lru_cache, six from django.utils import lru_cache, six
from django.utils.deprecation import RemovedInDjango110Warning
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.module_loading import import_string from django.utils.module_loading import import_string
@ -122,16 +119,7 @@ class Engine(object):
if isinstance(loader, six.string_types): if isinstance(loader, six.string_types):
loader_class = import_string(loader) loader_class = import_string(loader)
return loader_class(self, *args)
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)
else: else:
raise ImproperlyConfigured( raise ImproperlyConfigured(
"Invalid value in template loaders configuration: %r" % loader) "Invalid value in template loaders configuration: %r" % loader)

View File

@ -1,10 +1,5 @@
import warnings
from django.utils.deprecation import RemovedInDjango110Warning
from . import engines from . import engines
from .exceptions import TemplateDoesNotExist from .exceptions import TemplateDoesNotExist
from .loaders import base
def get_template(template_name, using=None): 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): def _engine_list(using=None):
return engines.all() if using is None else [engines[using]] 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)

View File

@ -6,8 +6,6 @@ from django.utils.inspect import func_supports_parameter
class Loader(object): class Loader(object):
# Only used to raise a deprecation warning. Remove in Django 1.10.
_accepts_engine_in_init = True
def __init__(self, engine): def __init__(self, engine):
self.engine = engine self.engine = engine

View File

@ -968,11 +968,6 @@ loaders. Custom ``Loader`` classes should inherit from
``django.template.loaders.base.Loader`` and define the ``get_contents()`` and ``django.template.loaders.base.Loader`` and define the ``get_contents()`` and
``get_template_sources()`` methods. ``get_template_sources()`` methods.
.. versionchanged:: 1.8
``django.template.loaders.base.Loader`` used to be defined at
``django.template.loader.BaseLoader``.
.. versionchanged:: 1.9 .. versionchanged:: 1.9
In previous versions of Django, custom loaders defined a single method: In previous versions of Django, custom loaders defined a single method: