def validate_password_length(self, key, field): if not has_valid_length(field, PASSWORD_LENGTH_MINIMUM, PASSWORD_LENGTH_MAXIMUM): raise InvalidArgumentError( "{}'s length must be {} ~ {}.".format( key, PASSWORD_LENGTH_MINIMUM, PASSWORD_LENGTH_MAXIMUM)) return field
def validate_email_format(self, key, field): if not is_valid_email(field): raise InvalidArgumentError( "{} must be fitted in email format.".format(key)) return field
def validate_not_empty(self, key, field): if not field: raise InvalidArgumentError("{} must be not empty.".format(key)) return field
def validate_session_time(self, key, field): if field not in session_time_choices: raise InvalidArgumentError("{} must be in {}." .format(key, session_time_choices)) return field
def validate_phone_format(self, key, field): if not is_valid_phone(field): raise InvalidArgumentError( "{} must be fitted in phone number format.".format(key)) return field