Improve convert_bool error message

The error message as it was confused me when the value was 'enabled' and
there was also a module parameter named 'enabled'.

    enabled is not a valid boolean.  Valid booleans include: yes, on, 1, true, ...

So by clearly describing it as a value, the confusion would have been
avoided.

    The value 'enabled' is not a valid boolean.  Valid booleans include: yes, on, 1, true, ...
This commit is contained in:
Dag Wieers 2018-02-12 16:14:18 +01:00 committed by Brian Coca
parent 17c0d3eae0
commit 487cf0ee8d

View file

@ -23,4 +23,4 @@ def boolean(value, strict=True):
elif normalized_value in BOOLEANS_FALSE or not strict:
return False
raise TypeError('%s is not a valid boolean. Valid booleans include: %s' % (to_text(value), ', '.join(repr(i) for i in BOOLEANS)))
raise TypeError("The value '%s' is not a valid boolean. Valid booleans include: %s" % (to_text(value), ', '.join(repr(i) for i in BOOLEANS)))