[PATCH 4 of 5 saem_ref] [seda] Generate a qualified ARK identifier for archive unit related to a transfer

Denis Laxalde denis.laxalde at logilab.fr
Wed Apr 11 17:40:23 CEST 2018


Philippe Pepiot a écrit :
> On 11/04/2018, Denis Laxalde wrote:
>> # HG changeset patch
>> # User Denis Laxalde <denis.laxalde at logilab.fr>
>> # Date 1523442172 -7200
>> #      Wed Apr 11 12:22:52 2018 +0200
>> # Node ID acb40395ff4ce5f9896b92819bd27f183c4aecf2
>> # Parent  ffa768d7ef7f034ccf882c0e271924434fa504c2
>> # Available At http://hg.logilab.org/review/cubes/saem_ref
>> #              hg pull http://hg.logilab.org/review/cubes/saem_ref -r acb40395ff4c
>> # EXP-Topic ark-for-archiveunit
>> [seda] Generate a qualified ARK identifier for archive unit related to a transfer
>>
>> When a SEDAArchiveUnit is created or related to an archive transfer we
>> generated an ARK identifier for this entity that is qualified with
>> respect to the transfer's ARK identifier.
>>
>> This is implemented through a subclass of
>> QualifiedARKIdentifierGenerator that is selected for SEDAArchiveUnit
>> entity type. This is similar to how Concept entities get their ARK from
>> their related ConceptScheme.
>>
>> Note that we had to fix an "ark" attribute for the SEDAArchiveUnit
>> created in automatic views tests (test_saem_ref.py) because otherwise,
>> an ark would have been generated based on parent SEDAArchiveTransfer
>> entity which itself has a generated ark that does not match what's
>> expected to produce a qualified identifier (namely, it has a random
>> NAAN, which corresponds to no existing NAA and its NAME part would have
>> no prefix/suffix).
>>
>> CONSEJIRA-431
>>
>> diff --git a/cubicweb_saem_ref/entities/__init__.py b/cubicweb_saem_ref/entities/__init__.py
>> --- a/cubicweb_saem_ref/entities/__init__.py
>> +++ b/cubicweb_saem_ref/entities/__init__.py
>> @@ -102,6 +102,20 @@ class OUARKIdentifierGenerator(Qualified
>>          return self._cw.entity_from_eid(authority)
>>  
>>  
>> +class SEDAArchiveUnitARKIdentifierGenerator(QualifiedARKIdentifierGenerator):
>> +    __select__ = (
>> +        ARKIdentifierGeneratorMixin.__select__
> 
> Shouldn't this be QualifiedARKIdentifierGenerator.__select__ ?

Yes it should, though there would be no functional change.
But this is a copy/paste and the error already appears three times so
I'll fix them all in a followup. Thanks.

> 
>> +        & match_kwargs('seda_archive_unit')
>> +    )
>> +
>> +    @property
>> +    def parent_entity(self):
>> +        transfer = self.cw_extra_kwargs['seda_archive_unit']
>> +        if hasattr(transfer, 'eid'):
>> +            return transfer
>> +        return self._cw.entity_from_eid(transfer)
>> +
>> +
>>  class ArkNAALocator(EntityAdapter):
>>      """Adapter responsible to retrieve the proper ARK Name Assigning Authority depending on the
>>      entity type



More information about the saem-devel mailing list