Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11806 closed (duplicate)

FormWizard.process_step() doesn't always have a validated Form.

Reported by: kiowa Owned by: nobody
Component: Documentation Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The FormWizard documentation says:

FormWizard.process_step()

    Hook for modifying the wizard's internal state, given a fully validated Form object. The Form is guaranteed to have clean, valid data.

But the form isn't always guaranteed to be clean - and thus give access to its cleaned_data mapping.

To achieve this you will need in your process_step:

process_step(self, request, form, step):
    form.full_clean()

Change History (5)

comment:1 Changed 7 years ago by Karen Tracey

Resolution: invalid
Status: newclosed

You've stated that the form isn't always guaranteed to be clean without providing an example of how that could happen. Based on the documentation and a brief look at the code, that happening would seem to be a coding error rather than a documentation problem. So as written I believe this ticket is invalid. Feel free to reopen with specifics on how to recreate a situation where process_step is called without a valid form, but the place to look for fixing it I believe will be in the code, not the documentation.

comment:2 Changed 7 years ago by Marco Paolini

Resolution: invalid
Status: closedreopened

in contrib/formtools/wizard.py

63 	        for i in range(current_step):
64 	            form = self.get_form(i, request.POST)
65 	            if request.POST.get("hash_%d" % i, '') != self.security_hash(request, form):
66 	                return self.render_hash_failure(request, i)
67 	            self.process_step(request, form, i)

line 67: form passed to self.process_step is _never_ cleaned (happens for all forms before current_step)

this is an old bug, I'm sure there are other tickets on this

comment:3 in reply to:  2 ; Changed 7 years ago by Karen Tracey

Resolution: duplicate
Status: reopenedclosed

Replying to mpaolini:

this is an old bug, I'm sure there are other tickets on this

If you believed that then why did you not search for existing tickets? Which would have brought up #10882. We don't need multiple tickets for the same problem.

comment:4 in reply to:  3 Changed 7 years ago by anonymous

Replying to kmtracey:

If you believed that then why did you not search for existing tickets? Which would have brought up #10882. We don't need multiple tickets for the same problem.

Ok my fault, please forgive me and commit the (3 months old) patch in #10882

comment:5 Changed 7 years ago by Marco Paolini

previous comment was mine

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