From 20334bc8aa0c2430c6e4f0093c283023e9a44849 Mon Sep 17 00:00:00 2001 From: Bill Fenner <fenner@fenron.net> Date: Sun, 10 Jun 2007 02:59:17 +0000 Subject: [PATCH] If the data is None, use an empty string in the hash instead. - Legacy-Id: 275 --- ietf/contrib/wizard.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ietf/contrib/wizard.py b/ietf/contrib/wizard.py index caaf7f9fc..290e58f5e 100644 --- a/ietf/contrib/wizard.py +++ b/ietf/contrib/wizard.py @@ -134,10 +134,18 @@ class Wizard( object ): Subclasses may want to take into account request-specific information 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 # Python 2.3, but Django requires 2.3 anyway, so that's OK. #pickled = pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL) + print "hashing %s" % data pickled = str(data) #XXX return md5.new(pickled).hexdigest()