Пример #1
0
    def _validate_author_id(cls, item):
        """Validate that author ID is in correct format.

        Args:
            item: GeneralSuggestionModel. The model to validate.
        """
        if not user_services.is_user_or_pseudonymous_id(item.author_id):
            cls._add_error(
                'final %s' %
                (base_model_validators.ERROR_CATEGORY_AUTHOR_CHECK),
                'Entity id %s: Author ID %s is in a wrong format. '
                'It should be either pid_<32 chars> or uid_<32 chars>.' %
                (item.id, item.author_id))
Пример #2
0
    def _validate_last_nonempty_message_author_id(cls, item):
        """Validate that last nonempty message author ID is in correct format.

        Args:
            item: GeneralFeedbackThreadModel. The model to validate.
        """
        if (item.last_nonempty_message_author_id
                and not user_services.is_user_or_pseudonymous_id(
                    item.last_nonempty_message_author_id)):
            cls._add_error(
                'final %s' %
                (base_model_validators.ERROR_CATEGORY_AUTHOR_CHECK),
                'Entity id %s: Last non-empty message author ID %s is in a '
                'wrong format. It should be either pid_<32 chars> or '
                'uid_<32 chars>.' %
                (item.id, item.last_nonempty_message_author_id))