[PATCH 2 of 2 saem_ref V2] [hook] export EAC ARK on AuthorityRecordId

Philippe Pepiot philippe.pepiot at logilab.fr
Fri Feb 24 15:45:01 CET 2017


On 02/24/2017 03:37 PM, Philippe Pepiot wrote:
> @@ -99,7 +104,21 @@ class EACImportService(eac.EACImportServ
>                  extentity.values['authority'] = set([self._authority.cwuri])
>              return extentity
>
> -        return imap(set_authority_or_naa, extentities)
> +        def move_record_id(extentities):
> +            for extentity in extentities:
> +                if (extentity.etype == 'AuthorityRecord'
> +                        and 'record_id' in extentity.values):
> +                    yield ExtEntity(etype='EACOtherRecordId',
> +                                    extid='EACOtherRecordId-{0}'.format(extentity.extid),
> +                                    values={
> +                                        'value': extentity.values.pop('record_id'),
> +                                        'eac_other_record_id_of': set([extentity.extid]),
> +                                    })
> +                yield extentity
> +
> +        extentities = imap(set_authority_or_naa, extentities)
> +        extentities = move_record_id(extentities)
> +        return extentities
>
>
>  class AllocateArk(Service):


Not sure about extid for EACOtherRecordId here, in particular when 
updating an existing record... I'll make more tests.



More information about the saem-devel mailing list