Opened 6 years ago

Closed 6 years ago

Last modified 5 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: master
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

Description

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 Changed 6 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Yes.

comment:2 Changed 6 years ago by Preston Timmons

I added a pull request here:

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

comment:3 Changed 6 years ago by Preston Timmons

Has patch: set

comment:4 Changed 6 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 5bc5ddd8b5d787c5e744efead184d46c55d03687:

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

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

In 5528e7d:

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

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