#35233: Push templates checks down to backend engine classes
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: Giannis
Type: | Terzopoulos
Cleanup/optimization | Status: assigned
Component: Core (System | Version: dev
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Giannis Terzopoulos):
Thank you for the pointers Adam! I finally found the time to look into
this and I have some questions.
> 2. `check_for_template_tags_with_the_same_name` is inaccurate because it
combines `libraries` from all template backends, so might report an issue
when none exists.
Regarding this, am I right in assuming that we want to allow same names
for tags across different engines; Should this test pass?
{{{
#!python
def test_different_backends_may_have_same_tags(self):
with self.settings(
TEMPLATES=[
{"BACKEND": "django.template.backends.django.DjangoTemplates",
"OPTIONS": {"libraries": {
"same_tags":
"check_framework.template_test_apps.same_tags_app_1"
".templatetags.same_tags"}}},
{"BACKEND": "django.template.backends.OtherBackend",
"OPTIONS": {"libraries": {
"same_tags":
"check_framework.template_test_apps.same_tags_app_2"
".templatetags.same_tags"}}}
]
):
self.assertListEqual(check_for_template_tags_with_the_same_name(None), [])
}}}
And one more thing, I am noticing that the `E001` logic is duplicated:
- in `Engine.__init__` - raises `ImproperlyConfigured`
(`template_backends.test_utils.TemplateUtilsTests.test_backend_improperly_configured`)
- and in `check_setting_app_dirs_loaders` (tests under
`check_framework.test_templates.CheckTemplateSettingsAppDirsTest`)
and I am wondering if it's enough to keep one of the two, perhaps the
check? 🤔
--
Ticket URL: <https://code.djangoproject.com/ticket/35233#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018e2a421d21-84a6da70-fc24-4b0e-9290-57b24af7d009-000000%40eu-central-1.amazonses.com.