Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#24685 closed Bug (fixed)

EngineHandler doesn't raise exception when duplicate aliases are registered

Reported by: Preston Timmons Owned by: Aymeric Augustin
Component: Template system Version: 1.8
Severity: Release blocker Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The django.template.utils.EngineHandler has a check to raise ImproperlyConfigured if multiple engines are specified with the same alias:

https://github.com/django/django/blob/master/django/template/utils.py#L72

This won't ever raise an error, though, because configuration is stored in an OrderedDict. Duplicate aliases simply overwrite previous ones.

Curtis ran into this problem when using settings like this without the NAME option:

TEMPLATES = [
    {
        'BACKEND': 'knights.django.KnightsTemplater',
        ...
    },
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        ...
    },
]

Change History (6)

comment:1 by Tim Graham, 10 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:2 by Aymeric Augustin, 10 years ago

Owner: changed from nobody to Aymeric Augustin
Status: newassigned

How embarrassing.

comment:3 by Aymeric Augustin, 10 years ago

Has patch: set

comment:4 by Preston Timmons, 10 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Aymeric Augustin <aymeric.augustin@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 1563b89:

Fixed #24685 -- Fixed check for template name unicity.

Thanks Preston Timmons for the report.

comment:6 by Aymeric Augustin <aymeric.augustin@…>, 10 years ago

In 1f0a6082:

[1.8.x] Fixed #24685 -- Fixed check for template name unicity.

Thanks Preston Timmons for the report.

Backport of 1563b89 from master

Note: See TracTickets for help on using tickets.
Back to Top