[Django] #23712: BaseForm._html_output() uses inconsistent formatting for normal row

13 views
Skip to first unread message

Django

unread,
Oct 24, 2014, 1:53:05 PM10/24/14
to django-...@googlegroups.com
#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.

Django

unread,
Oct 24, 2014, 1:54:22 PM10/24/14
to django-...@googlegroups.com
#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

unread,
Oct 24, 2014, 2:52:36 PM10/24/14
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
----------------------------+------------------------------------
Changes (by claudep):

* version: 1.7 => master
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:2>

Django

unread,
Oct 30, 2014, 9:37:46 AM10/30/14
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: JMGordon
Type: Bug | Status: assigned

Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
----------------------------+------------------------------------
Changes (by JMGordon):

* status: new => assigned
* owner: nobody => JMGordon


--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:3>

Django

unread,
Nov 15, 2014, 9:08:47 AM11/15/14
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: JMGordon
Type: Bug | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
----------------------------+------------------------------------
Changes (by wadevries):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:4>

Django

unread,
Nov 25, 2014, 10:10:52 AM11/25/14
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: JMGordon
Type: Bug | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
----------------------------+------------------------------------
Changes (by collinanderson):

* needs_docs: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:5>

Django

unread,
Nov 25, 2014, 10:10:55 AM11/25/14
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: JMGordon
Type: Bug | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
----------------------------+------------------------------------
Changes (by collinanderson):

* needs_docs: 1 => 0
* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:6>

Django

unread,
Dec 24, 2014, 12:28:23 PM12/24/14
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner:
Type: Bug | Status: new

Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------+------------------------------------
Changes (by JMGordon):

* owner: JMGordon =>
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:7>

Django

unread,
Jan 5, 2015, 10:38:30 PM1/5/15
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: raully7
Type: Bug | Status: assigned

Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
----------------------------+------------------------------------
Changes (by raully7):

* owner: => raully7


* status: new => assigned


Comment:

I'll try to create a patch before this weekend.

--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:8>

Django

unread,
Jan 5, 2015, 10:41:09 PM1/5/15
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: raully7
Type: Bug | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------------------
Changes (by timgraham):

* easy: 1 => 0


Comment:

Did you see the existing [https://github.com/django/django/pull/3529 pull
request] and the questions on it?

--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:9>

Django

unread,
Jan 6, 2015, 5:15:18 AM1/6/15
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: raully7
Type: Bug | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------------------

Comment (by raully7):

Replying to [comment:9 timgraham]:


> Did you see the existing [https://github.com/django/django/pull/3529
pull request] and the questions on it?

Sorry, I thought it's unsigned and wasn't aware of wadevries' pull
request.

And even worse, I just submitted another
[https://github.com/django/django/pull/3847 pull request]...

Sorry for bother your guys, I should be more careful.

--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:10>

Django

unread,
Jan 12, 2015, 3:35:10 PM1/12/15
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: raully7
Type: Bug | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:11>

Django

unread,
Jan 15, 2015, 8:20:19 PM1/15/15
to django-...@googlegroups.com
#23712: BaseForm._html_output() uses inconsistent formatting for normal row
----------------------------+------------------------------------
Reporter: alflanagan | Owner: raully7
Type: Bug | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"3f9ec12d9c9eff9a3b1a205d87c7e66587cf9967"]:
{{{
#!CommitTicketReference repository=""
revision="3f9ec12d9c9eff9a3b1a205d87c7e66587cf9967"
Fixed #23712 -- Fixed KeyError with BaseForm._html_output()
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23712#comment:12>

Reply all
Reply to author
Forward
0 new messages