#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         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  1              |      UI/UX:  0
-------------------------------+--------------------
 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>
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/053.179505fb6606da06f2819ce3c9c04d7b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to