Test the given value against all the validators on the field, and either raise a `ValidationError` or simply return.
(self, value)
| 540 | return value |
| 541 | |
| 542 | def run_validators(self, value): |
| 543 | """ |
| 544 | Test the given value against all the validators on the field, |
| 545 | and either raise a `ValidationError` or simply return. |
| 546 | """ |
| 547 | errors = [] |
| 548 | for validator in self.validators: |
| 549 | try: |
| 550 | if getattr(validator, 'requires_context', False): |
| 551 | validator(value, self) |
| 552 | else: |
| 553 | validator(value) |
| 554 | except ValidationError as exc: |
| 555 | # If the validation error contains a mapping of fields to |
| 556 | # errors then simply raise it immediately rather than |
| 557 | # attempting to accumulate a list of errors. |
| 558 | if isinstance(exc.detail, dict): |
| 559 | raise |
| 560 | errors.extend(exc.detail) |
| 561 | except DjangoValidationError as exc: |
| 562 | errors.extend(get_error_detail(exc)) |
| 563 | if errors: |
| 564 | raise ValidationError(errors) |
| 565 | |
| 566 | def to_internal_value(self, data): |
| 567 | """ |
no test coverage detected