src/pds_doi_service/core/actions/release.py
def run(self, **kwargs):
        """
        Performs a release of a DOI that has been previously reserved.

        A reserved DOI can be "released" either to the review step, or
        released directly to the DOI service provider for immediate registration.

        The input is a path to a text file containing the previously returned
        output of a 'reserve' or 'draft' action.

        Parameters
        ----------
        kwargs : dict
            The parsed command-line arguments for the release action.

        Returns
        -------
        output_label : str
            The output label text body reflecting the status of the released
            DOI(s).

        Raises
        ------
        CriticalDOIException
            If any unrecoverable errors are encountered during validation of
            the input DOI's.

        """
        output_dois = []

        self.parse_arguments(kwargs)

        try:
            # Parse, complete and validate the input dois prior to their
            # submission
            dois = self._parse_input(self._input)
            dois = self._complete_dois(dois)
            dois = self._validate_dois(dois)

            for input_doi in dois:
                # Create a JSON format label to send to the service provider
                io_doi_label = self._record_service.create_doi_record(input_doi, content_type=CONTENT_TYPE_JSON)

                # If the next step is to release, submit to the service provider and
                # use the response label for the local transaction database entry
                if not self._review:
                    # Determine the correct HTTP verb and URL for submission of this DOI
                    method, url = self._web_client.endpoint_for_doi(input_doi, self._name)

                    output_doi, o_doi_label = self._web_client.submit_content(
                        url=url, method=method, payload=io_doi_label, content_type=CONTENT_TYPE_JSON
                    )
                # Otherwise, DOI object is ready to be logged
                else:
                    output_doi = input_doi

                # Otherwise, if the next step is review, the label we've already
                # created has marked all the Doi's as being the "review" step
                # so its ready to be submitted to the local transaction history
                transaction = self.m_transaction_builder.prepare_transaction(
                    self._submitter,
                    output_doi,
                    input_path=input_doi.input_source,
                    output_content_type=CONTENT_TYPE_JSON,
                )

                # Commit the transaction to the local database
                transaction.log()

                # Append the latest version of the Doi object to return
                # as a label
                output_dois.append(output_doi)
        # Propagate input format exceptions, force flag should not affect
        # these being raised and certain callers (such as the API) look
        # for this exception specifically
        except InputFormatException as err:
            raise err
        # If we catch this exception, it means validation produced a warning
        # and the --force flag is not set, so log the error and exit without
        # producing an output label
        except WarningDOIException as err:
            logger.error(str(err))
            raise err
        # Convert all other errors into a CriticalDOIException to report back
        except Exception as err:
            raise CriticalDOIException(str(err))

        # Create the return output label containing records for all submitted DOI's
        # Note this action always returns JSON format to ensure interoperability
        # between the potential service providers
        output_label = self._record_service.create_doi_record(output_dois, content_type=CONTENT_TYPE_JSON)

        return output_label

        Performs a release of a DOI that has been previously reserved.

        A reserved DOI can be "released" either to the review step, or
        released directly to the DOI service provider for immediate registration.

        The input is a path to a text file containing the previously returned
        output of a 'reserve' or 'draft' action.

        Parameters
        ----------
        kwargs : dict
            The parsed command-line arguments for the release action.

        Returns
        -------
        output_label : str
            The output label text body reflecting the status of the released
            DOI(s).

        Raises
        ------
        CriticalDOIException
            If any unrecoverable errors are encountered during validation of
            the input DOI's.

        
Performs a release of a DOI that has been previously reserved.
A reserved DOI can be "released" either to the review step, or
released directly to the DOI service provider for immediate registration.

The input is a path to a text file containing the previously returned
output of a 'reserve' or 'draft' action.

Parameters

kwargs : dict
The parsed command-line arguments for the release action.

Returns

output_label : str
The output label text body reflecting the status of the released
DOI(s).

Raises

CriticalDOIException
If any unrecoverable errors are encountered during validation of
the input DOI's.
Performs a release of a DOI that has been previously reserved . A reserved DOI can be " released " either to the review step or released directly to the DOI service provider for immediate registration . The input is a path to a text file containing the previously returned output of a ' reserve ' or ' draft ' action . Parameters kwargs : dict The parsed command - line arguments for the release action . Returns output_label : str The output label text body reflecting the status of the released DOI ( s ) . Raises CriticalDOIException If any unrecoverable errors are encountered during validation of the input DOI ' s .
def run(self, **kwargs):
        output_dois = []
        self.parse_arguments(kwargs)
        try:
            dois = self._parse_input(self._input)
            dois = self._complete_dois(dois)
            dois = self._validate_dois(dois)
            for input_doi in dois:
                io_doi_label = self._record_service.create_doi_record(input_doi, content_type=CONTENT_TYPE_JSON)
                if not self._review:
                    method, url = self._web_client.endpoint_for_doi(input_doi, self._name)
                    output_doi, o_doi_label = self._web_client.submit_content(
                        url=url, method=method, payload=io_doi_label, content_type=CONTENT_TYPE_JSON
                    )
                else:
                    output_doi = input_doi
                transaction = self.m_transaction_builder.prepare_transaction(
                    self._submitter,
                    output_doi,
                    input_path=input_doi.input_source,
                    output_content_type=CONTENT_TYPE_JSON,
                )
                transaction.log()
                output_dois.append(output_doi)
        except InputFormatException as err:
            raise err
        except WarningDOIException as err:
            logger.error(str(err))
            raise err
        except Exception as err:
            raise CriticalDOIException(str(err))
        output_label = self._record_service.create_doi_record(output_dois, content_type=CONTENT_TYPE_JSON)
        return output_label
def run ( self , ** kwargs ) : output_dois = [ ] self . parse_arguments ( kwargs ) try : dois = self . _parse_input ( self . _input ) dois = self . _complete_dois ( dois ) dois = self . _validate_dois ( dois ) for input_doi in dois : io_doi_label = self . _record_service . create_doi_record ( input_doi , content_type = CONTENT_TYPE_JSON ) if not self . _review : method , url = self . _web_client . endpoint_for_doi ( input_doi , self . _name ) output_doi , o_doi_label = self . _web_client . submit_content ( url = url , method = method , payload = io_doi_label , content_type = CONTENT_TYPE_JSON ) else : output_doi = input_doi transaction = self . m_transaction_builder . prepare_transaction ( self . _submitter , output_doi , input_path = input_doi . input_source , output_content_type = CONTENT_TYPE_JSON , ) transaction . log ( ) output_dois . append ( output_doi ) except InputFormatException as err : raise err except WarningDOIException as err : logger . error ( str ( err ) ) raise err except Exception as err : raise CriticalDOIException ( str ( err ) ) output_label = self . _record_service . create_doi_record ( output_dois , content_type = CONTENT_TYPE_JSON ) return output_label
Performs a release of a DOI that has been previously reserved.
Performs a release of a DOI that has been previously reserved .
"""
        Performs a release of a DOI that has been previously reserved.

        A reserved DOI can be "released" either to the review step, or
        released directly to the DOI service provider for immediate registration.

        The input is a path to a text file containing the previously returned
        output of a 'reserve' or 'draft' action.

        Parameters
        ----------
        kwargs : dict
            The parsed command-line arguments for the release action.

        Returns
        -------
        output_label : str
            The output label text body reflecting the status of the released
            DOI(s).

        Raises
        ------
        CriticalDOIException
            If any unrecoverable errors are encountered during validation of
            the input DOI's.

        """ # Parse, complete and validate the input dois prior to their # submission # Create a JSON format label to send to the service provider # If the next step is to release, submit to the service provider and # use the response label for the local transaction database entry # Determine the correct HTTP verb and URL for submission of this DOI # Otherwise, DOI object is ready to be logged # Otherwise, if the next step is review, the label we've already # created has marked all the Doi's as being the "review" step # so its ready to be submitted to the local transaction history # Commit the transaction to the local database # Append the latest version of the Doi object to return # as a label # Propagate input format exceptions, force flag should not affect # these being raised and certain callers (such as the API) look # for this exception specifically # If we catch this exception, it means validation produced a warning # and the --force flag is not set, so log the error and exit without # producing an output label # Convert all other errors into a CriticalDOIException to report back # Create the return output label containing records for all submitted DOI's # Note this action always returns JSON format to ensure interoperability # between the potential service providers
self