From 4c18facdf7d0f609cd7f3c72c142d7be7b14a6c9 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Mon, 1 Mar 2010 23:26:08 +0000 Subject: [PATCH] Fixed #1104: set `FormWizard.extra_context` in `__init__` to avoid context leakage. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12644 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/formtools/wizard.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/django/contrib/formtools/wizard.py b/django/contrib/formtools/wizard.py index b97e090cfd..427623dc33 100644 --- a/django/contrib/formtools/wizard.py +++ b/django/contrib/formtools/wizard.py @@ -19,19 +19,25 @@ from django.views.decorators.csrf import csrf_protect class FormWizard(object): - # Dictionary of extra template context variables. - extra_context = {} - # The HTML (and POST data) field name for the "step" variable. step_field_name="wizard_step" # METHODS SUBCLASSES SHOULDN'T OVERRIDE ################################### def __init__(self, form_list, initial=None): - "form_list should be a list of Form classes (not instances)." + """ + Start a new wizard with a list of forms. + + form_list should be a list of Form classes (not instances). + """ self.form_list = form_list[:] self.initial = initial or {} - self.step = 0 # A zero-based counter keeping track of which step we're in. + + # Dictionary of extra template context variables. + extra_context = {} + + # A zero-based counter keeping track of which step we're in. + self.step = 0 def __repr__(self): return "step: %d\nform_list: %s\ninitial_data: %s" % (self.step, self.form_list, self.initial)