Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#14576 closed (fixed)

Regression in FormWizard

Reported by: cyberdelia Owned by: nobody
Component: contrib.formtools Version: 1.2
Severity: Keywords: form wizard sprintnov13
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It seems that changeset [14291] introduced a regression in FormWizard.
The last form of the wizard is never passed to done(self, request, form_list) , that make FormWizard much useless.

Here is the regression test that should help :

def test_14291(self):
    reached = [False]
    that = self
        
    class WizardWithProcessStep(WizardClass):
        def done(self, request, form_list):
            reached[0] = True
            that.assertTrue(len(form_list) == 2)
        
    wizard = WizardWithProcessStep([WizardPageOneForm,
                                                                WizardPageTwoForm])
    
    data = {"0-field": "test",
                  "1-field": "test2",
                  "hash_0": "2fdbefd4c0cad51509478fbacddf8b13",
                  "wizard_step": "1"}
    wizard(DummyRequest(POST=data))
    self.assertTrue(reached[0])

Attachments (2)

14576-regression-test.py (1.1 KB) - added by cyberdelia 3 years ago.
Regression test as a patch
trac-14576.diff (1.8 KB) - added by steph 3 years ago.
Patch and tests

Download all attachments as: .zip

Change History (10)

Changed 3 years ago by cyberdelia

Regression test as a patch

comment:1 Changed 3 years ago by jezdez

  • milestone set to 1.3
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 3 years ago by steph

Patch and tests

comment:2 Changed 3 years ago by steph

  • Has patch set

.. just added a patch to fix the problem.

comment:3 Changed 3 years ago by steph

  • Keywords sprintnov13 added

comment:4 Changed 3 years ago by lukeplant

  • Resolution set to fixed
  • Status changed from new to closed

(In [14574]) Fixed #14576 - FormWizard.done() method doesn't get passed the last form in the list

Thanks to cyberdelia for report and test, and steph for the initial patch.

comment:5 Changed 3 years ago by ramiro

(In [15044]) [1.2.X] Fixed #14576, #14946 - FormWizard.done() method doesn't get passed the last form in the list.

Thanks to cyberdelia for report and test, and steph for the initial patch.

Backport of r14574 from trunk.

comment:6 Changed 3 years ago by zyga

  • Resolution fixed deleted
  • Status changed from closed to reopened

This bug is not fixed properly.

Instead of appending a fresh instance of the last form (using get_form()) it should just append the "form" variable as that is the already created instance of the last form and it has been validated.

The solution currently applied for 1.3 breaks accessing cleaned_data.

comment:7 Changed 3 years ago by zyga

  • Resolution set to fixed
  • Status changed from reopened to closed

On deeper inspection this is actually fixed properly in trunk, the patch attached to this bug is just wrong.

comment:8 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.