﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7038	FormWizard  fails on forms with BooleanField when field is unselected	anonymous	mcroydon	"The form wizard fails to match its security hash when processing a form containing at least one BooleanField where the BooleanField's checkbox is unselected (e.g. False).  This results in (on my machine) the form containing the BooleanField being redisplayed.  If *all* the BooleanFields on a form are selected, it appears to work correctly.

I was able to workaround (not fix) by overriding the security_hash method as follows:

{{{
    def security_hash(self, request, form):

        for bf in form:
            if bf.field.__class__ != BooleanField:
                data = [(bf.name, bf.data or u'')] + [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)
        return md5.new(pickled).hexdigest()
}}}

The problem appears (to my untrained eye) to be in the line assigning the value of data where bf.data = False and thus gets assigned ''.

I'm using SVN 7412."		closed	contrib.formtools	dev		duplicate	FormWizard, BooleanField, hash failure	rajesh.dhawan@… dev@…	Accepted	1	0	0	0	0	0
