Skip to content

Commit

Permalink
chore: remove references to TEMPLATE_CONTEXT_PROCESSORS
Browse files Browse the repository at this point in the history
  • Loading branch information
jerivas committed Jul 22, 2021
1 parent 8556460 commit 4294db6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
11 changes: 4 additions & 7 deletions mezzanine/pages/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ def check_context_processor(app_configs, **kwargs):

name = "mezzanine.pages.context_processors.page"

if settings.TEMPLATES:
loaded = any(
name in config.get("OPTIONS", {}).get("context_processors", {})
for config in settings.TEMPLATES
)
else:
loaded = name in settings.TEMPLATE_CONTEXT_PROCESSORS
loaded = any(
name in config.get("OPTIONS", {}).get("context_processors", {})
for config in settings.TEMPLATES
)

if not loaded:
issues.append(
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ addopts =
--cov-report html
--cov-report term:skip-covered
# Original coverage was 54% (not great), but at least ensure we don't go below
--cov-fail-under 56
--cov-fail-under 57
10 changes: 3 additions & 7 deletions tests/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,9 @@ def test_check_context_processor(self):
)
]
app_config = apps.get_app_config("pages")
with override_settings(TEMPLATES=None):
with override_settings(TEMPLATE_CONTEXT_PROCESSORS=tuple()):
issues = check_context_processor(app_config)
self.assertEqual(issues, expected_warning)
with override_settings(TEMPLATE_CONTEXT_PROCESSORS=(context_processor,)):
issues = check_context_processor(app_config)
self.assertEqual(issues, [])
with override_settings(TEMPLATES=()):
issues = check_context_processor(app_config)
self.assertEqual(issues, expected_warning)
with override_settings(TEMPLATES=templates):
issues = check_context_processor(app_config)
self.assertEqual(issues, [])

0 comments on commit 4294db6

Please sign in to comment.