(input, spec)
| 117 | |
| 118 | @staticmethod |
| 119 | def validate(input, spec): |
| 120 | if not input and (not spec.get("required", None) or spec.get("default", None)): |
| 121 | return |
| 122 | |
| 123 | if input.lower() not in POSITIVE_BOOLEAN | NEGATIVE_BOOLEAN: |
| 124 | raise validation.ValidationError( |
| 125 | len(input), |
| 126 | "Does not look like boolean. Pick from [%s]" |
| 127 | % ", ".join(POSITIVE_BOOLEAN | NEGATIVE_BOOLEAN), |
| 128 | ) |
| 129 | |
| 130 | def _construct_template(self): |
| 131 | self.template = "{0} (boolean)" |