Opened 9 years ago
Closed 9 years ago
#23712 closed Bug (fixed)
BaseForm._html_output() uses inconsistent formatting for normal row
Reported by: | A. Lloyd Flanagan | Owned by: | ppYang |
---|---|---|---|
Component: | Forms | 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 )
Steps to reproduce:
- Create a form with at least one HiddenInput form field.
- Override a method such as
as_p()
by calling_html_output()
with:- A
normal_row
parameter containing the string "%(field_name)s" - A
row_ender
parameter which is *not* the last tag innormal_row
- A
- Attempt to render the form. This will result in a builtins.KeyError: 'field_name' message.
Under these conditions, BaseForm._html_output() attempts to create a new row to hold the hidden input fields. When it does, it uses normal_row % {..}
, but the dictionary does not have the field "field_name" in it. This causes a KeyError. On the other hand, if normal_row
ends in a row_ender
tag, it doesn't create a new row, and the method succeeds.
Change History (12)
comment:1 Changed 9 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 9 years ago by
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Bug |
Version: | 1.7 → master |
comment:3 Changed 9 years ago by
Owner: | changed from nobody to Joseph Gordon |
---|---|
Status: | new → assigned |
comment:4 Changed 9 years ago by
Has patch: | set |
---|
comment:5 Changed 9 years ago by
Needs documentation: | set |
---|
comment:6 Changed 9 years ago by
Needs documentation: | unset |
---|---|
Patch needs improvement: | set |
comment:7 Changed 9 years ago by
Owner: | Joseph Gordon deleted |
---|---|
Status: | assigned → new |
comment:8 Changed 9 years ago by
Owner: | set to ppYang |
---|---|
Status: | new → assigned |
comment:9 follow-up: 10 Changed 9 years ago by
Easy pickings: | unset |
---|
Did you see the existing pull request and the questions on it?
comment:10 Changed 9 years ago by
Replying to timgraham:
Did you see the existing pull request and the questions on it?
Sorry, I thought it's unsigned and wasn't aware of wadevries' pull request.
And even worse, I just submitted another pull request...
Sorry for bother your guys, I should be more careful.
comment:11 Changed 9 years ago by
Patch needs improvement: | unset |
---|
comment:12 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I'll try to create a patch before this weekend.