Opened 10 years ago
Last modified 10 years ago
#23712 closed Bug
BaseForm._html_output() uses inconsistent formatting for normal row — at Version 1
Reported by: | A. Lloyd Flanagan | Owned by: | nobody |
---|---|---|---|
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.
Note:
See TracTickets
for help on using tickets.