Ticket #8653: hashfix.diff
File hashfix.diff, 1.1 KB (added by , 16 years ago) |
---|
-
django/contrib/formtools/utils.py
15 15 order, pickles the result with the SECRET_KEY setting, then takes an md5 16 16 hash of that. 17 17 """ 18 # Ensure that the hash does not change when a BooleanField's bound19 # data is a string `False' or a boolean False.20 # Rather than re-coding this special behaviour here, we21 # create a dummy BooleanField and call its clean method to get a22 # boolean True or False verdict that is consistent with23 # BooleanField.clean()24 dummy_bool = BooleanField(required=False)25 def _cleaned_data(bf):26 if isinstance(bf.field, BooleanField):27 return dummy_bool.clean(bf.data)28 return bf.data29 18 30 data = [(bf.name, _cleaned_data(bf) or '') for bf in form]19 data = [(bf.name, bf.field.clean(bf.data) or '') for bf in form] 31 20 data.extend(args) 32 21 data.append(settings.SECRET_KEY) 33 22