Opened 8 years ago

Closed 8 years ago

Last modified 8 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 Changed 8 years ago by Tim Graham

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:2 Changed 8 years ago by Aymeric Augustin

Owner: changed from nobody to Aymeric Augustin
Status: newassigned

How embarrassing.

comment:3 Changed 8 years ago by Aymeric Augustin

Has patch: set

comment:4 Changed 8 years ago by Preston Timmons

Triage Stage: AcceptedReady for checkin

comment:5 Changed 8 years ago by Aymeric Augustin <aymeric.augustin@…>

Resolution: fixed
Status: assignedclosed

In 1563b89:

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

Thanks Preston Timmons for the report.

comment:6 Changed 8 years ago by Aymeric Augustin <aymeric.augustin@…>

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