#13568 closed (fixed)
KeyError raised in template rendering when the number of placeholders differs between singular and plural
| Reported by: | deltoide | Owned by: | deltoide |
|---|---|---|---|
| Component: | Internationalization | Version: | dev |
| Severity: | 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
Here is a simple example to reproduce the bug:
template file: index.html
{% load i18n %}
{% blocktrans with myextra_field as extra_field and myamount as amount count myyears as years %}
That will cost $ {{ amount }} per year. {{ extra_field }}
{% plural %}
That will cost $ {{ amount }} per {{ years }} years.
{% endblocktrans %}
views.py:
from django.http import HttpResponse
from django.template import Context, loader
from django.http import HttpResponse
def index(request):
t = loader.get_template('index.html')
c = Context({
'myamount' : 10,
'myyears' : 1,
'myextra_field' : 2,
})
return HttpResponse(t.render(c))
Attachments (2)
Change History (8)
comment:1 by , 15 years ago
| Owner: | changed from to |
|---|
by , 15 years ago
| Attachment: | i18n_13568.diff added |
|---|
comment:2 by , 15 years ago
| Has patch: | set |
|---|
by , 15 years ago
| Attachment: | i18n_13568.2.diff added |
|---|
Fix + regression test (with link to this bug 13568)
comment:3 by , 15 years ago
| milestone: | → 1.3 |
|---|---|
| Triage Stage: | Unreviewed → Ready for checkin |
comment:4 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:5 by , 15 years ago
Note:
See TracTickets
for help on using tickets.
Fix + regression test