Opened 5 years ago

Closed 5 years ago

#16787 closed Bug (fixed)

{% load %} doesn't work with libraries in package heierarcy

Reported by: Ivan Sagalaev Owned by: Ivan Sagalaev
Component: Template system Version: 1.3
Severity: Release blocker Keywords:
Cc: chris@… 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 (last modified by Jannis Leidel)

In other words {% load package.lib %} doesn't work.

The docstring of load tag suggests it should work and it used to work before changeset r12944. We should allow this behavior again and document it properly in docs.

Attachments (5)

16787.diff (3.1 KB) - added by Ivan Sagalaev 5 years ago.
Patch with tests and docs
16787.2.diff (4.0 KB) - added by Ivan Sagalaev 5 years ago.
Patch with all new included.
16787.3.diff (5.9 KB) - added by Ivan Sagalaev 5 years ago.
More specific tests
16787.4.diff (6.0 KB) - added by Ivan Sagalaev 5 years ago.
Fixed some typos, reformulated docstring.
16787.5.diff (5.9 KB) - added by Ivan Sagalaev 5 years ago.
Patch updated to current trunk

Download all attachments as: .zip

Change History (12)

comment:1 Changed 5 years ago by Jannis Leidel

Description: modified (diff)
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

This is a regression and therefore a release blocker.

Changed 5 years ago by Ivan Sagalaev

Attachment: 16787.diff added

Patch with tests and docs

Changed 5 years ago by Ivan Sagalaev

Attachment: 16787.2.diff added

Patch with all new included.

Changed 5 years ago by Ivan Sagalaev

Attachment: 16787.3.diff added

More specific tests

Changed 5 years ago by Ivan Sagalaev

Attachment: 16787.4.diff added

Fixed some typos, reformulated docstring.

comment:2 Changed 5 years ago by Chris Heisel

Cc: chris@… added
Type: UncategorizedBug

I'm getting a test failure:

python runtests.py --settings=test_sqlite templates

TemplateSyntaxError: 'subpackage.echo' is not a valid tag library: Template library subpackage.echo not found, tried django.templatetags.subpackage.echo,django.contrib.flatpages.templatetags.subpackage.echo,django.contrib.comments.templatetags.subpackage.echo,django.contrib.admin.templatetags.subpackage.echo,django.contrib.staticfiles.templatetags.subpackage.echo,django.contrib.humanize.templatetags.subpackage.echo,regressiontests.templates.templatetags.subpackage.echo

comment:3 Changed 5 years ago by Tobias McNulty

Has patch: set
Triage Stage: AcceptedReady for checkin

The patch includes an empty __init__.py file which didn't get added for me when I applied it. Running this fixes it:

touch tests/regressiontests/templates/templatetags/subpackage/__init__.py

I reviewed the patch with Ivan at the sprint today and I'm happy with v4. As he said in the description, this functionality used to exist, so we don't think there's a need for a separate section in the docs explaining it.

comment:4 Changed 5 years ago by Ivan Sagalaev

BTW does anyone if it's possible to include an empty file in a diff?

comment:5 Changed 5 years ago by Aymeric Augustin

I did a lot of research on this problem recently and the best solution I've found is to generate the diff with git — but that only works if you apply it with "git apply".

comment:6 Changed 5 years ago by Ivan Sagalaev

This won't work for me since I use bzr :-). This is the one place where standardizing on svn and patch utility sucks…

Changed 5 years ago by Ivan Sagalaev

Attachment: 16787.5.diff added

Patch updated to current trunk

comment:7 Changed 5 years ago by Aymeric Augustin

Resolution: fixed
Status: newclosed

In [17133]:

Fixed #16787 -- Restored the ability to {% load %} template tags libraries within packages. Thanks Ivan Sagalaev for the report and patch.

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