#23712: BaseForm._html_output() uses inconsistent formatting for normal row
-------------------------------+--------------------------------------
Reporter: alflanagan | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by alflanagan):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> Steps to reproduce:
>
> 1. Create a form with at least one *HiddenInput* form field.
> 2. Override a method such as `as_p()` by calling `_html_output()` with:
> a. A `normal_row` parameter containing the string "%(field_name)s"
> b. A `row_ender` parameter which is *not* the last tag in `normal_row`
> 3. 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.
New description:
Steps to reproduce:
1. Create a form with at least one '''HiddenInput''' form field.
2. Override a method such as `as_p()` by calling `_html_output()` with:
a. A `normal_row` parameter containing the string "%(field_name)s"
b. A `row_ender` parameter which is *not* the last tag in `normal_row`
3. 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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.7745bf93fc03143ab48b6f0ef4a7d221%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.