Opened 12 years ago

Closed 12 years ago

#7169 closed (duplicate)

Minor bug in :: 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: no UI/UX: no


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.


Change History (2)

comment:1 Changed 12 years ago by tzellman

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 12 years ago by anonymous

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top