def validate_email(self, _, email): """Email property validator.""" if not Person.is_valid_email(email): message = "Email address '{}' is invalid. Valid email must be provided" raise ValidationError(message.format(email)) return email
def validate_email(self, key, email): if not Person.is_valid_email(email): message = "Must provide a valid email address" raise ValidationError(message) return email
def _create(self, parent, action): raise ValidationError( "Can't create {type} object".format(type=action.type))
def validate_status(self, key, value): if value == "Value Error": raise ValueError("raised Value Error") elif value == "Validation Error": raise ValidationError("raised Validation Error") return value
def validate_delete(mapper, connection, target): """Validates is delete of Relationship is allowed.""" if is_external_app_user() and not target.is_external: raise ValidationError( 'External application can delete only external relationships.')
def validate_is_external(self, key, value): """Validates is change of is_external column value allowed.""" if is_external_app_user() and (not value or self.is_external is False): raise ValidationError( 'External application can create only external relationships.') return value
def validate_name(self, _, name): """Name property validator.""" if not name: raise ValidationError("Name is empty") return name
def _validate(_action, ntuple): try: return ntuple(**_action) except TypeError: raise ValidationError("Missed action parameters")
def validate_review_status(self, _, value): # pylint: disable=no-self-use """Add explicit non-nullable validation.""" if value is None: raise ValidationError("review_status for the object is not specified") return value