src/pds_doi_service/core/actions/update.py
def _meld_dois(existing_doi, new_doi):
        """
        Melds the fields from a new Doi object into an existing one, updating
        only those fields that are set on the new Doi and which are different
        from those in the existing.

        Parameters
        ----------
        existing_doi : Doi
            The existing Doi to update.
        new_doi : Doi
            The new Doi to meld into the existing.

        Returns
        -------
        updated_doi : Doi
            A new Doi object that represents the melding of the provided objects.

        """
        existing_doi_fields = existing_doi.__dict__.copy()
        new_doi_fields = new_doi.__dict__

        for key in existing_doi_fields:
            if new_doi_fields[key] and existing_doi_fields[key] != new_doi_fields[key]:
                # Don't overwrite the original date_record_added, if present in the existing record
                if key == "date_record_added" and existing_doi_fields["date_record_added"]:
                    continue

                # Don't overwrite existing status, we'll be saving it in previous_status later on
                if key == "status":
                    continue

                existing_doi_fields[key] = new_doi_fields[key]

        updated_doi = Doi(**existing_doi_fields)

        return updated_doi

        Melds the fields from a new Doi object into an existing one, updating
        only those fields that are set on the new Doi and which are different
        from those in the existing.

        Parameters
        ----------
        existing_doi : Doi
            The existing Doi to update.
        new_doi : Doi
            The new Doi to meld into the existing.

        Returns
        -------
        updated_doi : Doi
            A new Doi object that represents the melding of the provided objects.

        
Melds the fields from a new Doi object into an existing one, updating
only those fields that are set on the new Doi and which are different
from those in the existing.

Parameters

existing_doi : Doi
The existing Doi to update.
new_doi : Doi
The new Doi to meld into the existing.

Returns

updated_doi : Doi
A new Doi object that represents the melding of the provided objects.
Melds the fields from a new Doi object into an existing one updating only those fields that are set on the new Doi and which are different from those in the existing . Parameters existing_doi : Doi The existing Doi to update . new_doi : Doi The new Doi to meld into the existing . Returns updated_doi : Doi A new Doi object that represents the melding of the provided objects .
def _meld_dois(existing_doi, new_doi):
        existing_doi_fields = existing_doi.__dict__.copy()
        new_doi_fields = new_doi.__dict__
        for key in existing_doi_fields:
            if new_doi_fields[key] and existing_doi_fields[key] != new_doi_fields[key]:
                if key == "date_record_added" and existing_doi_fields["date_record_added"]:
                    continue
                if key == "status":
                    continue
                existing_doi_fields[key] = new_doi_fields[key]
        updated_doi = Doi(**existing_doi_fields)
        return updated_doi
def _meld_dois ( existing_doi , new_doi ) : existing_doi_fields = existing_doi . __dict__ . copy ( ) new_doi_fields = new_doi . __dict__ for key in existing_doi_fields : if new_doi_fields [ key ] and existing_doi_fields [ key ] != new_doi_fields [ key ] : if key == "date_record_added" and existing_doi_fields [ "date_record_added" ] : continue if key == "status" : continue existing_doi_fields [ key ] = new_doi_fields [ key ] updated_doi = Doi ( ** existing_doi_fields ) return updated_doi
Melds the fields from a new Doi object into an existing one, updating
only those fields that are set on the new Doi and which are different
from those in the existing.
Melds the fields from a new Doi object into an existing one updating only those fields that are set on the new Doi and which are different from those in the existing .
"""
        Melds the fields from a new Doi object into an existing one, updating
        only those fields that are set on the new Doi and which are different
        from those in the existing.

        Parameters
        ----------
        existing_doi : Doi
            The existing Doi to update.
        new_doi : Doi
            The new Doi to meld into the existing.

        Returns
        -------
        updated_doi : Doi
            A new Doi object that represents the melding of the provided objects.

        """ # Don't overwrite the original date_record_added, if present in the existing record # Don't overwrite existing status, we'll be saving it in previous_status later on
existing_doi
new_doi