Code

Opened 3 years ago

Closed 2 years ago

#16787 closed Bug (fixed)

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

Reported by: isagalaev Owned by: isagalaev
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 jezdez)

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 isagalaev 3 years ago.
Patch with tests and docs
16787.2.diff (4.0 KB) - added by isagalaev 3 years ago.
Patch with all new included.
16787.3.diff (5.9 KB) - added by isagalaev 3 years ago.
More specific tests
16787.4.diff (6.0 KB) - added by isagalaev 3 years ago.
Fixed some typos, reformulated docstring.
16787.5.diff (5.9 KB) - added by isagalaev 3 years ago.
Patch updated to current trunk

Download all attachments as: .zip

Change History (12)

comment:1 Changed 3 years ago by jezdez

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Severity changed from Normal to Release blocker
  • Triage Stage changed from Unreviewed to Accepted

This is a regression and therefore a release blocker.

Changed 3 years ago by isagalaev

Patch with tests and docs

Changed 3 years ago by isagalaev

Patch with all new included.

Changed 3 years ago by isagalaev

More specific tests

Changed 3 years ago by isagalaev

Fixed some typos, reformulated docstring.

comment:2 Changed 3 years ago by cmheisel

  • Cc chris@… added
  • Type changed from Uncategorized to Bug

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 3 years ago by tobias

  • Has patch set
  • Triage Stage changed from Accepted to Ready 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 3 years ago by isagalaev

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

comment:5 Changed 3 years ago by aaugustin

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 3 years ago by isagalaev

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

Changed 3 years ago by isagalaev

Patch updated to current trunk

comment:7 Changed 2 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

In [17133]:

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.