[Django] #22785: render_revalidation_failure in NamedUrlWizardView has unused parameters

9 views
Skip to first unread message

Django

unread,
Jun 6, 2014, 5:06:33 PM6/6/14
to django-...@googlegroups.com
#22785: render_revalidation_failure in NamedUrlWizardView has unused parameters
--------------------------------------+--------------------
Reporter: danielsamuels | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.formtools | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
See this line of code:
https://github.com/django/django/blob/master/django/contrib/formtools/wizard/views.py#L705

I was hoping to be able to override the render_done method and raise a
ValidationError for some fields and have the Wizard show those errors on
the relevant step, but it appears that the Wizard simply performs a
redirect which means you can't actually do any additional validation (this
may be a separate issue though). Either way, I noticed that although the
form object (with errors added) is passed to render_revalidation_failure,
it doesn't actually get used, unlike render_revalidation_failure used in
the base WizardView.

--
Ticket URL: <https://code.djangoproject.com/ticket/22785>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 16, 2014, 9:06:13 AM6/16/14
to django-...@googlegroups.com
#22785: render_revalidation_failure in NamedUrlWizardView has unused parameters
-------------------------------------+-------------------------------------
Reporter: danielsamuels | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: master
Component: contrib.formtools | Resolution: needsinfo
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => closed
* needs_docs: => 0
* resolution: => needsinfo
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

How should it be used? The `render_revalidation_failure()` method needs to
have the same signature across all subclasses regardless of whether or not
the subclasses uses them all.

--
Ticket URL: <https://code.djangoproject.com/ticket/22785#comment:1>

Django

unread,
Jun 16, 2014, 9:14:33 AM6/16/14
to django-...@googlegroups.com
#22785: render_revalidation_failure in NamedUrlWizardView has unused parameters
-------------------------------------+-------------------------------------
Reporter: danielsamuels | Owner: nobody

Type: | Status: closed
Cleanup/optimization | Version: master
Component: contrib.formtools | Resolution: needsinfo
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by danielsamuels):

Sorry, I chose a terrible title for this ticket. The main issue is that
for any `FormWizard` which isn't a `NamedUrlWizardView` you're able to
raise ValidationErrors and have those displayed on the form which failed.
When a form fails validation on a `NamedUrlWizard` you just get redirected
back to the form and any ValidationErrors which were raised get silently
discarded. This issue only really affects people who are overriding
`render_done`, raising a ValidationError and returning
`render_revalidation_failure()`.

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

Django

unread,
Jun 16, 2014, 9:27:05 AM6/16/14
to django-...@googlegroups.com
#22785: NamedUrlWizard errors are silently discarded when overriding render_done()
-------------------------------------+-------------------------------------
Reporter: danielsamuels | Owner: nobody
Type: | Status: new

Cleanup/optimization | Version: master
Component: contrib.formtools | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: closed => new
* resolution: needsinfo =>


Comment:

Okay, I'm not too familiar with the code. Can you propose a fix?

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

Django

unread,
Jun 16, 2014, 9:29:49 AM6/16/14
to django-...@googlegroups.com
#22785: NamedUrlWizard errors are silently discarded when overriding render_done()
-------------------------------------+-------------------------------------
Reporter: danielsamuels | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: contrib.formtools | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by anonymous):

The way I fixed it in my project was to push the ValidationErrors into the
messages framework and then pull them out on the other side, not sure if
that's a valid solution for Django itself though.

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

Django

unread,
Jun 16, 2014, 8:13:28 PM6/16/14
to django-...@googlegroups.com
#22785: NamedUrlWizard errors are silently discarded when overriding render_done()
-------------------------------------+-------------------------------------
Reporter: danielsamuels | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: contrib.formtools | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timo):

I don't think so -- we wouldn't want to add coupling between the two
contrib apps.

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

Django

unread,
Jun 18, 2014, 8:00:18 AM6/18/14
to django-...@googlegroups.com
#22785: NamedUrlWizard errors are silently discarded when overriding render_done()
-------------------------------------+-------------------------------------
Reporter: danielsamuels | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: master
Component: contrib.formtools | Resolution: needsinfo

Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => closed
* resolution: => needsinfo


Comment:

Closing as "needs info" absent a proposal for how this should be addressed
-- if someone has a suggestion, please reopen.

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

Django

unread,
Jun 18, 2014, 8:21:48 AM6/18/14
to django-...@googlegroups.com
#22785: NamedUrlWizard errors are silently discarded when overriding render_done()
-------------------------------------+-------------------------------------
Reporter: danielsamuels | Owner: nobody

Type: | Status: closed
Cleanup/optimization | Version: master
Component: contrib.formtools | Resolution: needsinfo
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by thomasrumbold@…):

I don't mean to be unhelpful here - but as I understand it, this existing
issue has been closed because there hasn't been a proposal to fix it
within 12 days of it being submitted. That doesn't change the fact that it
exists. Surely the default would be to leave it open until further notice
and potentially, someone can contribute?

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

Django

unread,
Jun 18, 2014, 9:05:08 AM6/18/14
to django-...@googlegroups.com
#22785: NamedUrlWizard errors are silently discarded when overriding render_done()
-------------------------------------+-------------------------------------
Reporter: danielsamuels | Owner: nobody

Type: | Status: closed
Cleanup/optimization | Version: master
Component: contrib.formtools | Resolution: needsinfo
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timo):

Yes, and I don't mean to be aggressive in closing it. I haven't studied
the issue, but I am not sure it is possible to fix in a general fashion
since the solution Daniel came up with involved using messages. We try to
keep open tickets actionable, so I would rather keep this closed until
someone decides it's possible to fix rather than keeping an open ticket
for something where no clear path of action exists. Are the two wizards
intended to work in the same way or is this simply a limitation of
`NamedUrlWizardView`?

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

Django

unread,
Jun 18, 2014, 9:30:18 AM6/18/14
to django-...@googlegroups.com
#22785: NamedUrlWizard errors are silently discarded when overriding render_done()
-------------------------------------+-------------------------------------
Reporter: danielsamuels | Owner: nobody

Type: | Status: closed
Cleanup/optimization | Version: master
Component: contrib.formtools | Resolution: needsinfo
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by danielsamuels):

As far as I'm aware all of the Wizards except `NamedUrlWizardView` handle
ValidationErrors correctly - because they re-render the form directly
instead of redirecting like `NamedUrlWizardView` does.

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

Reply all
Reply to author
Forward
0 new messages