Skip to content

Commit 20334bc

Browse files
committed
If the data is None, use an empty string in the hash instead.
- Legacy-Id: 275
1 parent fdca154 commit 20334bc

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

ietf/contrib/wizard.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,18 @@ def security_hash(self, request, form):
134134
Subclasses may want to take into account request-specific information
135135
such as the IP address.
136136
"""
137-
data = [(bf.name, bf.data) for bf in form] + [settings.SECRET_KEY]
137+
data = []
138+
for bf in form:
139+
if bf.data is None:
140+
d = ''
141+
else:
142+
d = bf.data
143+
data.append((bf.name, d))
144+
data.append(settings.SECRET_KEY)
138145
# Use HIGHEST_PROTOCOL because it's the most efficient. It requires
139146
# Python 2.3, but Django requires 2.3 anyway, so that's OK.
140147
#pickled = pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL)
148+
print "hashing %s" % data
141149
pickled = str(data) #XXX
142150
return md5.new(pickled).hexdigest()
143151

0 commit comments

Comments
 (0)