Opened 13 years ago

Closed 11 years ago

#16096 closed New feature (fixed)

Template instances should have an origin attribute.

Reported by: Jeremy Dunck Owned by: nobody
Component: Template system Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Templates are constructed with an optional origin argument; this is used for debugging purposes.

But I think it would be useful for the Template instance to have an origin attribute -- then template origins could be more easily inspected and logged outside the django.template infrastructure. The specific use case I have in mind is making it clearer to FE devs which templates/template dirs are being used for a given request.

Template's constructor receives an origin parameter, so this should be a simple change.

Change History (5)

comment:1 by Julien Phalip, 13 years ago

Triage Stage: UnreviewedAccepted

This makes sense and it can't hurt. Are you thinking of any particular API other than just setting the origin attribute to the Template instance?

comment:2 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:3 by Preston Timmons, 11 years ago

I added a pull request for this here.

https://github.com/django/django/pull/1534

comment:4 by Tim Graham, 11 years ago

Has patch: set
Patch needs improvement: set

comment:5 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 8625c7aab3760d16572792fea23a95e572e28ead:

Fixed #16096 -- Added origin attribute to template instances.

Thanks jdunck for the suggestion.

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