Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 def _create(self, parent, action):
     raise ValidationError(
         "Can't create {type} object".format(type=action.type))
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 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.')
Ejemplo n.º 6
0
 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
Ejemplo n.º 7
0
 def validate_name(self, _, name):
     """Name property validator."""
     if not name:
         raise ValidationError("Name is empty")
     return name
Ejemplo n.º 8
0
 def _validate(_action, ntuple):
     try:
         return ntuple(**_action)
     except TypeError:
         raise ValidationError("Missed action parameters")
Ejemplo n.º 9
0
  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