src/pds_doi_service/core/actions/release.py
def _validate_dois(self, dois):
        """
        Validates the list of DOI objects prior to their submission.

        Depending on the configuration of the PDS DOI service, DOI objects may
        be validated against a schema as well as internal checks performed by
        the validator class.

        Any exceptions or warnings encountered during the checks are stored
        until all DOI's have been checked. Depending on the state of the
        force flag, these collected exceptions are either raised as a single
        exception, or simply logged.

        Parameters
        ----------
        dois : list of Doi
            The Doi objects to validate.

        Returns
        -------
        dois : list of Doi
            The validated list of Doi objects.

        """
        exception_classes = []
        exception_messages = []

        for doi in dois:
            try:
                # If user is attempting to move a record with no DOI to review,
                # raise an exception
                if not doi.doi and self._review:
                    raise InvalidRecordException(
                        f"Record provided with identifier {doi.pds_identifier} does not have a DOI assigned.\n"
                        f"A DOI must be reserved for the record before it can be moved to Review."
                    )

                single_doi_label = self._record_service.create_doi_record(doi)

                # Validate the label representation of the DOI
                self._validator_service.validate(single_doi_label)

                # Validate the object representation of the DOI
                self._doi_validator.validate_release_request(doi)
            except (
                DuplicatedTitleDOIException,
                InvalidIdentifierException,
                UnexpectedDOIActionException,
                TitleDoesNotMatchProductTypeException,
                SiteURLNotExistException,
            ) as err:
                (exception_classes, exception_messages) = collect_exception_classes_and_messages(
                    err, exception_classes, exception_messages
                )

        # If there is at least one exception caught, either raise a
        # WarningDOIException or log a warning with all the messages,
        # depending on the the state of the force flag
        if len(exception_classes) > 0:
            raise_or_warn_exceptions(exception_classes, exception_messages, log=self._force)

        return dois

        Validates the list of DOI objects prior to their submission.

        Depending on the configuration of the PDS DOI service, DOI objects may
        be validated against a schema as well as internal checks performed by
        the validator class.

        Any exceptions or warnings encountered during the checks are stored
        until all DOI's have been checked. Depending on the state of the
        force flag, these collected exceptions are either raised as a single
        exception, or simply logged.

        Parameters
        ----------
        dois : list of Doi
            The Doi objects to validate.

        Returns
        -------
        dois : list of Doi
            The validated list of Doi objects.

        
Validates the list of DOI objects prior to their submission.
Depending on the configuration of the PDS DOI service, DOI objects may
be validated against a schema as well as internal checks performed by
the validator class.

Any exceptions or warnings encountered during the checks are stored
until all DOI's have been checked. Depending on the state of the
force flag, these collected exceptions are either raised as a single
exception, or simply logged.

Parameters

dois : list of Doi
The Doi objects to validate.

Returns

dois : list of Doi
The validated list of Doi objects.
Validates the list of DOI objects prior to their submission . Depending on the configuration of the PDS DOI service DOI objects may be validated against a schema as well as internal checks performed by the validator class . Any exceptions or warnings encountered during the checks are stored until all DOI ' s have been checked . Depending on the state of the force flag these collected exceptions are either raised as a single exception or simply logged . Parameters dois : list of Doi The Doi objects to validate . Returns dois : list of Doi The validated list of Doi objects .
def _validate_dois(self, dois):
        exception_classes = []
        exception_messages = []
        for doi in dois:
            try:
                if not doi.doi and self._review:
                    raise InvalidRecordException(
                        f"Record provided with identifier {doi.pds_identifier} does not have a DOI assigned.\n"
                        f"A DOI must be reserved for the record before it can be moved to Review."
                    )
                single_doi_label = self._record_service.create_doi_record(doi)
                self._validator_service.validate(single_doi_label)
                self._doi_validator.validate_release_request(doi)
            except (
                DuplicatedTitleDOIException,
                InvalidIdentifierException,
                UnexpectedDOIActionException,
                TitleDoesNotMatchProductTypeException,
                SiteURLNotExistException,
            ) as err:
                (exception_classes, exception_messages) = collect_exception_classes_and_messages(
                    err, exception_classes, exception_messages
                )
        if len(exception_classes) > 0:
            raise_or_warn_exceptions(exception_classes, exception_messages, log=self._force)
        return dois
def _validate_dois ( self , dois ) : exception_classes = [ ] exception_messages = [ ] for doi in dois : try : if not doi . doi and self . _review : raise InvalidRecordException ( f"Record provided with identifier {doi.pds_identifier} does not have a DOI assigned.\n" f"A DOI must be reserved for the record before it can be moved to Review." ) single_doi_label = self . _record_service . create_doi_record ( doi ) self . _validator_service . validate ( single_doi_label ) self . _doi_validator . validate_release_request ( doi ) except ( DuplicatedTitleDOIException , InvalidIdentifierException , UnexpectedDOIActionException , TitleDoesNotMatchProductTypeException , SiteURLNotExistException , ) as err : ( exception_classes , exception_messages ) = collect_exception_classes_and_messages ( err , exception_classes , exception_messages ) if len ( exception_classes ) > 0 : raise_or_warn_exceptions ( exception_classes , exception_messages , log = self . _force ) return dois
Validates the list of DOI objects prior to their submission.
Validates the list of DOI objects prior to their submission .
"""
        Validates the list of DOI objects prior to their submission.

        Depending on the configuration of the PDS DOI service, DOI objects may
        be validated against a schema as well as internal checks performed by
        the validator class.

        Any exceptions or warnings encountered during the checks are stored
        until all DOI's have been checked. Depending on the state of the
        force flag, these collected exceptions are either raised as a single
        exception, or simply logged.

        Parameters
        ----------
        dois : list of Doi
            The Doi objects to validate.

        Returns
        -------
        dois : list of Doi
            The validated list of Doi objects.

        """ # If user is attempting to move a record with no DOI to review, # raise an exception # Validate the label representation of the DOI # Validate the object representation of the DOI # If there is at least one exception caught, either raise a # WarningDOIException or log a warning with all the messages, # depending on the the state of the force flag
self
dois