BaseForm._html_output() uses inconsistent formatting for normal row
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 in normal_row
- 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)
Description: |
modified (diff)
|
Triage Stage: |
Unreviewed → Accepted
|
Type: |
Uncategorized → Bug
|
Version: |
1.7 → master
|
Owner: |
changed from nobody to Joseph Gordon
|
Status: |
new → assigned
|
Needs documentation: |
unset
|
Patch needs improvement: |
set
|
Owner: |
Joseph Gordon removed
|
Status: |
assigned → new
|
Owner: |
set to ppYang
|
Status: |
new → assigned
|
Patch needs improvement: |
unset
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
I'll try to create a patch before this weekend.