(self, value)
| 651 | db_type = 'uuid' |
| 652 | |
| 653 | def validate(self, value): |
| 654 | val = super(UUID, self).validate(value) |
| 655 | if val is None: |
| 656 | return |
| 657 | if isinstance(val, _UUID): |
| 658 | return val |
| 659 | if isinstance(val, str): |
| 660 | try: |
| 661 | return _UUID(val) |
| 662 | except ValueError: |
| 663 | # fall-through to error |
| 664 | pass |
| 665 | raise ValidationError("{0} {1} is not a valid uuid".format( |
| 666 | self.column_name, value)) |
| 667 | |
| 668 | def to_python(self, value): |
| 669 | return self.validate(value) |
no test coverage detected