Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24235 closed Cleanup/optimization (fixed)

Deprecate is_usable attribute on template loaders?

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


Each Django loaders has a boolean attribute of "is_usable". It seems the only use for this comes from the egg loader when setuptools isn't installed. If "is_usable" is false, a warning is raised in engine.find_template_loader, but otherwise the loader is silently ignored for template loading.

It seems like that is the wrong behavior. I think the loaders should fail loudly if they're missing configuration. Otherwise, it's unclear why they're not used to find templates. I ran into this when writing a sample loader and forgetting to specify "is_usable" as True on it.

Unless there's a use case for silently ignoring template loaders, I think we should deprecate this behavior.

Change History (5)

comment:1 by Aymeric Augustin, 9 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization


comment:2 by Preston Timmons, 9 years ago

I added a pull request here:

comment:3 by Preston Timmons, 9 years ago

Has patch: set

comment:4 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 5bc5ddd8b5d787c5e744efead184d46c55d03687:

Fixed #24235 -- Removed is_usable attribute from template loaders.

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

In 5528e7d:

Refs #24235 -- Removed unused is_usable attribute from base template Loader.

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