Skip to content

Commit 17155d3

Browse files
Fixed corner-case bug in formtools wizard.py and preview.py, in case of a None value -- thanks, Honza
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7277 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent 8e14a4e commit 17155d3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

django/contrib/formtools/preview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def security_hash(self, request, form):
105105
Subclasses may want to take into account request-specific information
106106
such as the IP address.
107107
"""
108-
data = [(bf.name, bf.data) for bf in form] + [settings.SECRET_KEY]
108+
data = [(bf.name, bf.data or '') for bf in form] + [settings.SECRET_KEY]
109109
# Use HIGHEST_PROTOCOL because it's the most efficient. It requires
110110
# Python 2.3, but Django requires 2.3 anyway, so that's OK.
111111
pickled = pickle.dumps(data, pickle.HIGHEST_PROTOCOL)

django/contrib/formtools/wizard.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def security_hash(self, request, form):
146146
Subclasses may want to take into account request-specific information,
147147
such as the IP address.
148148
"""
149-
data = [(bf.name, bf.data) for bf in form] + [settings.SECRET_KEY]
149+
data = [(bf.name, bf.data or '') for bf in form] + [settings.SECRET_KEY]
150150
# Use HIGHEST_PROTOCOL because it's the most efficient. It requires
151151
# Python 2.3, but Django requires 2.3 anyway, so that's OK.
152152
pickled = pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL)
@@ -198,6 +198,7 @@ def render_template(self, request, form, previous_fields, step, context=None):
198198
step_field -- The name of the hidden field containing the step.
199199
step0 -- The current step (zero-based).
200200
step -- The current step (one-based).
201+
step_count -- The total number of steps.
201202
form -- The Form instance for the current step (either empty
202203
or with errors).
203204
previous_fields -- A string representing every previous data field,

0 commit comments

Comments
 (0)