Code

Opened 6 years ago

Closed 6 years ago

#7169 closed (duplicate)

Minor bug in wizards.py :: render_template

Reported by: tzellman Owned by: nobody
Component: contrib.formtools Version: master
Severity: Keywords: formtools wizard
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This is actually only a problem if (a) you are using (or copied) the default render_template, and (b) you are overriding the get_template method to return different pages based on the passed-in step variable. The error is on line 212. The code is currently using the self.step variable instead of the passed-in step variable. The problem (as you will see) is that the self.step variable is never mutated, other than in the constructor. Therefore, every time render_template is called, self.step will be 0, and the 1st template will be requested.

Current code:

        return render_to_response(self.get_template(self.step), dict(context,

Proposed fix:

        return render_to_response(self.get_template(step), dict(context,

In addition, you may consider updating the self.step value. Currently it doesn't really serve any purpose.

This wasn't a show stopper for me since I provided my own render_template method in my subclass. I just wanted to make you guys aware.

Thanks,
Tom

Attachments (0)

Change History (2)

comment:1 Changed 6 years ago by tzellman

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I didn't realize someone had just submitted ticket #7168. Same bug request. Just note that self.step is never modified and is therefore useless.

comment:2 Changed 6 years ago by anonymous

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

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.