Opened 10 years ago

Last modified 9 years ago

#23712 closed Bug

BaseForm._html_output() uses inconsistent formatting for normal row — at Initial Version

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

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:
    1. A normal_row parameter containing the string "%(field_name)s"
    2. 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.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top