Revision f1638b0b lib/config.py
b/lib/config.py | ||
---|---|---|
659 | 659 |
# FIXME: assuming list type |
660 | 660 |
if key in constants.IPOLICY_PARAMETERS: |
661 | 661 |
exp_type = float |
662 |
# if the value is int, it can be converted into float |
|
663 |
convertible_types = [int] |
|
662 | 664 |
else: |
663 | 665 |
exp_type = list |
666 |
convertible_types = [] |
|
667 |
# Try to convert from allowed types, if necessary. |
|
668 |
if any(isinstance(value, ct) for ct in convertible_types): |
|
669 |
try: |
|
670 |
value = exp_type(value) |
|
671 |
ipolicy[key] = value |
|
672 |
except ValueError: |
|
673 |
pass |
|
664 | 674 |
if not isinstance(value, exp_type): |
665 | 675 |
result.append("%s has invalid instance policy: for %s," |
666 | 676 |
" expecting %s, got %s" % |
Also available in: Unified diff