diff options
| author | Alex Gaynor <alex.gaynor@rd.io> | 2012-09-07 14:37:21 -0400 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@rd.io> | 2012-09-07 14:37:21 -0400 |
| commit | 6a5a12ea3e3193b3658b9237b86d98bc37d668d7 (patch) | |
| tree | 15eddff4e8f7787f71759a0fc3c7c54bf6048c70 /django | |
| parent | e4ea53677449cfc56a0093bfbd92cb482020bb1e (diff) | |
Fixed #17888 -- no longer silence exceptions inside of check_test. Thanks to brutasse for the patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/forms/widgets.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py index fdb9f50688..7651efccd0 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -507,11 +507,7 @@ class CheckboxInput(Widget): def render(self, name, value, attrs=None): final_attrs = self.build_attrs(attrs, type='checkbox', name=name) - try: - result = self.check_test(value) - except: # Silently catch exceptions - result = False - if result: + if self.check_test(value): final_attrs['checked'] = 'checked' if not (value is True or value is False or value is None or value == ''): # Only add the 'value' attribute if a value is non-empty. @@ -525,7 +521,7 @@ class CheckboxInput(Widget): return False value = data.get(name) # Translate true and false strings to boolean values. - values = {'true': True, 'false': False} + values = {'true': True, 'false': False} if isinstance(value, six.string_types): value = values.get(value.lower(), value) return value |
