def __setattr__(self, key, value):
    """Set attribute.

    Setting a value on an object of this type will only work for attributes
    defined in ATTRIBUTES.  To make other assignments possible it is necessary
    to override this method in subclasses.

    It is important that assignment is restricted in this way because
    this validation is used as validation for parsing.  Absent this restriction
    it would be possible for method names to be overwritten.

    Args:
      key: Name of attribute to set.
      value: Attributes new value.

    Raises:
      ValidationError when trying to assign to a value that does not exist.
    """

    if key in self.ATTRIBUTES:
      value = self.GetAttribute(key)(value)
      object.__setattr__(self, key, value)
    else:
      raise ValidationError('Class \'%s\' does not have attribute \'%s\''
                            % (self.__class__, key))
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/api/validation.py/Validated.__setattr__/original