If the data is None, use an empty string in the hash instead.

- Legacy-Id: 275
This commit is contained in:
Bill Fenner 2007-06-10 02:59:17 +00:00
parent fdca154e75
commit 20334bc8aa

View file

@ -134,10 +134,18 @@ class Wizard( object ):
Subclasses may want to take into account request-specific information Subclasses may want to take into account request-specific information
such as the IP address. such as the IP address.
""" """
data = [(bf.name, bf.data) for bf in form] + [settings.SECRET_KEY] data = []
for bf in form:
if bf.data is None:
d = ''
else:
d = bf.data
data.append((bf.name, d))
data.append(settings.SECRET_KEY)
# Use HIGHEST_PROTOCOL because it's the most efficient. It requires # Use HIGHEST_PROTOCOL because it's the most efficient. It requires
# Python 2.3, but Django requires 2.3 anyway, so that's OK. # Python 2.3, but Django requires 2.3 anyway, so that's OK.
#pickled = pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL) #pickled = pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL)
print "hashing %s" % data
pickled = str(data) #XXX pickled = str(data) #XXX
return md5.new(pickled).hexdigest() return md5.new(pickled).hexdigest()