Revision ec5ebdf5
b/snf-webproject/synnefo/webproject/management/utils.py | ||
---|---|---|
43 | 43 |
def parse_bool(value, strict=True): |
44 | 44 |
"""Convert a string to boolen value. |
45 | 45 |
|
46 |
If string is True, then ValueError will be raised, if the string can not be
|
|
46 |
If strict is True, then ValueError will be raised, if the string can not be
|
|
47 | 47 |
converted to boolean. Otherwise the string will be returned as is. |
48 | 48 |
|
49 | 49 |
""" |
... | ... | |
53 | 53 |
return False |
54 | 54 |
|
55 | 55 |
if strict: |
56 |
raise ValueError("Can convert '%s' to boolean value")
|
|
56 |
raise ValueError("Cannot convert '%s' to boolean value" % value)
|
|
57 | 57 |
else: |
58 | 58 |
return value |
59 | 59 |
|
Also available in: Unified diff