Skip to content

Commit

Permalink
Fix broken boolean validator
Browse files Browse the repository at this point in the history
The boolean validator treats missing values as True. They should be treated as False, both semantically and because unchecked  HTML checkboxes in forms transmit empty values on form submits
  • Loading branch information
deniszgonjanin authored and amercader committed Jun 16, 2015
1 parent 3d91789 commit f2e44b5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ckan/logic/validators.py
Expand Up @@ -55,6 +55,8 @@ def int_validator(value, context):
raise Invalid(_('Invalid integer'))

def boolean_validator(value, context):
if value is missing:
return False
if isinstance(value, bool):
return value
if value.lower() in ['true', 'yes', 't', 'y', '1']:
Expand Down

0 comments on commit f2e44b5

Please sign in to comment.