Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #8653: make formtools' security hash more rubust. Silly that I …

…didn't think of this before; thanks to bthomas for providing the obvious fix.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2ca8cf36280d427ca396f14029f22421539a1fce 1 parent 71076ae
@jacobian jacobian authored
Showing with 1 addition and 12 deletions.
  1. +1 −12 django/contrib/formtools/
13 django/contrib/formtools/
@@ -15,19 +15,8 @@ def security_hash(request, form, *args):
order, pickles the result with the SECRET_KEY setting, then takes an md5
hash of that.
- # Ensure that the hash does not change when a BooleanField's bound
- # data is a string `False' or a boolean False.
- # Rather than re-coding this special behaviour here, we
- # create a dummy BooleanField and call its clean method to get a
- # boolean True or False verdict that is consistent with
- # BooleanField.clean()
- dummy_bool = BooleanField(required=False)
- def _cleaned_data(bf):
- if isinstance(bf.field, BooleanField):
- return dummy_bool.clean(
- return
- data = [(, _cleaned_data(bf) or '') for bf in form]
+ data = [(, bf.field.clean( or '') for bf in form]

0 comments on commit 2ca8cf3

Please sign in to comment.
Something went wrong with that request. Please try again.