def validate(self, data): if data == {}: return try: validate_schema(data) except SchemaValidationError as e: raise ValidationError(e.message)
def validate(self, data): if not data or data == {}: return try: validate_schema(data) except SchemaValidationError as e: raise ValidationError(e.message)
def to_internal_value(self, data): if not data: return try: validate_schema(data) except SchemaValidationError as e: raise ValidationError(e.message) return data
def to_internal_value(self, data): if data is None: return if data == "" or data == {}: return {} try: validate_schema(data) except SchemaValidationError as e: raise ValidationError(e.message) return data