Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28711 closed Bug (fixed)

unordered_list template filter does not work with lazy translations

Reported by: Jonas Haag 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

Description (last modified by Jonas Haag)

I would expect that the following assertion holds true:

from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import unordered_list

assert unordered_list(['', _('lazy')]) == unordered_list(['', 'lazy']))

I.e., unordered_list handles lazy translations as if they were strings.

This used to work in Django < 1.8, more specifically before the patch to this ticket: https://code.djangoproject.com/ticket/23260

This bug exists in all versions 1.8–master.

Pull request follows.

Change History (8)

comment:1 by Jonas Haag, 7 years ago

Description: modified (diff)

comment:3 by Claude Paroz, 7 years ago

Triage Stage: UnreviewedAccepted

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

Resolution: fixed
Status: newclosed

In d997ab7:

Fixed #28711 -- Fixed unordered_list template filter with lazy translations.

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

In a831e4b:

[2.0.x] Fixed #28711 -- Fixed unordered_list template filter with lazy translations.

Backport of d997ab776477dd9ecb158229b2622c7f1ed93dfb from master

comment:6 by Tim Graham <timograham@…>, 7 years ago

In 1399f8a:

Refs #28711 -- Replaced ugettext_lazy() with gettext_lazy() in a test.

As per c651331b34b7c3841c126959e6e52879bc6f0834.

comment:7 by Jonas Haag, 7 years ago

Will this be backported to Django 1.11? IIUC it still receives bug fixes until end of this year.

comment:8 by Tim Graham, 7 years ago

Fixes for regressions are generally backported to the latest stable release but as this is such a long standing regression, it doesn't seem critical. I'm wary of introducing a different regression this late in 1.11.x's bug fix period and the patch does not backport cleanly to 1.11 where Python 2 compatibility is required.

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