From 1fed8dd715cc734f51c162d4362d34d357925bc4 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 16 Jul 2015 09:32:42 -0400 Subject: [PATCH] Fixed #25120 -- Deprecated egg template loader. --- django/conf/global_settings.py | 1 - django/template/loaders/eggs.py | 2 ++ docs/internals/deprecation.txt | 2 ++ docs/ref/templates/api.txt | 4 ++++ docs/releases/1.9.txt | 3 +++ tests/template_tests/test_loaders.py | 1 + 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index e92f8f5e825..0febd3f08be 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -208,7 +208,6 @@ TEMPLATE_DIRS = [] TEMPLATE_LOADERS = [ 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', - # 'django.template.loaders.eggs.Loader', ] # List of processors used by RequestContext to populate the context. diff --git a/django/template/loaders/eggs.py b/django/template/loaders/eggs.py index f614d7bcc78..04fa239c865 100644 --- a/django/template/loaders/eggs.py +++ b/django/template/loaders/eggs.py @@ -15,6 +15,8 @@ try: except ImportError: resource_string = None +warnings.warn('The egg template loader is deprecated.', RemovedInDjango20Warning) + class EggOrigin(Origin): diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index f597963d8c2..9aaa5676a43 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -82,6 +82,8 @@ details on these changes. * ``Field._get_val_from_obj()`` will be removed in favor of ``Field.value_from_object()``. +* ``django.template.loaders.eggs.Loader`` will be removed. + .. _deprecation-removed-in-1.10: 1.10 diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt index 6ff2dd6c7bf..6847d832b9f 100644 --- a/docs/ref/templates/api.txt +++ b/docs/ref/templates/api.txt @@ -893,6 +893,10 @@ loaders that come with Django: .. class:: eggs.Loader + .. deprecated:: 1.9 + + Distributing applications as eggs is not recommended. + Just like ``app_directories`` above, but it loads templates from Python eggs rather than from the filesystem. diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index a9217b6145f..783009db07a 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -1004,6 +1004,9 @@ Miscellaneous * ``django.db.models.Field._get_val_from_obj()`` is deprecated in favor of ``Field.value_from_object()``. +* ``django.template.loaders.eggs.Loader`` is deprecated as distributing + applications as eggs is not recommended. + .. removed-features-1.9: Features removed in 1.9 diff --git a/tests/template_tests/test_loaders.py b/tests/template_tests/test_loaders.py index f1263105c69..36147935649 100644 --- a/tests/template_tests/test_loaders.py +++ b/tests/template_tests/test_loaders.py @@ -153,6 +153,7 @@ class EggLoaderTests(SimpleTestCase): del pkg_resources._provider_factories[MockLoader] @classmethod + @ignore_warnings(category=RemovedInDjango20Warning) def setUpClass(cls): cls.engine = Engine(loaders=[ 'django.template.loaders.eggs.Loader',