Opened 15 years ago

Closed 15 years ago

Last modified 15 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: no UI/UX: no

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 by Karen Tracey, 15 years ago

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 by Marco Paolini, 15 years ago

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

in reply to:  2 ; comment:3 by Karen Tracey, 15 years ago

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.

in reply to:  3 comment:4 by anonymous, 15 years ago

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 by Marco Paolini, 15 years ago

previous comment was mine

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