Opened 12 years ago
Closed 12 years ago
#21417 closed Bug (fixed)
use TEMPLATE_STRING_IF_INVALID format string in blocktrans
| Reported by: | Kevin Turner | Owned by: | |
|---|---|---|---|
| Component: | Template system | Version: | 1.6 |
| Severity: | Normal | Keywords: | |
| Cc: | 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
ticket:19915 makes it so that TEMPLATE_STRING_IF_INVALID may show when template strings fail inside blocktrans blocks. It doesn't, however, treat that as a format string in the way that FilterExpression.resolve does (as is described in the documentation).
Change History (5)
comment:1 by , 12 years ago
| Component: | Uncategorized → Template system |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 12 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 12 years ago
| Has patch: | set |
|---|---|
| Owner: | removed |
| Status: | assigned → new |
comment:4 by , 12 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:5 by , 12 years ago
| Owner: | set to |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
To reproduce:
TEMPLATE_STRING_IF_INVALID = "Invalid(%s)"python manage.py shelland type:from django.template import Template, Context t = Template("""{% load i18n %} Outside: {{ missing }} {% blocktrans %}Inside: {{ missing }}{% endblocktrans %}""") print(t.render(Context())) >>> Outside: Invalid(missing) >>> Inside: Invalid(%s)Missing variables in blocktrans tag are handled here: https://github.com/django/django/blob/326539f6a4936cda031b4a5f7caad788569f3329/django/templatetags/i18n.py#L152. It should work the same like
FilterExpression.resolve.