Fwd: Re: [PATCH eac V5] Add some attribute to EACRessourceRelation

gvandevelde guillaume.vandevelde at logilab.fr
Mon Aug 12 17:32:00 CEST 2019




-------- Forwarded Message --------
Subject: 	Re: [PATCH eac V5] Add some attribute to EACRessourceRelation
Date: 	Mon, 12 Aug 2019 15:24:53 +0200
From: 	gvandevelde <gvandevelde at logilab.fr>
To: 	Denis Laxalde <denis.laxalde at logilab.fr>




On 8/12/19 3:17 PM, Denis Laxalde wrote:
> Guillaume Vandevelde a écrit :
>> # HG changeset patch
>> # User Guillaume Vandevelde <gvandevelde at logilab.fr>
>> # Date 1564500697 -7200
>> # Tue Jul 30 17:31:37 2019 +0200
>> # Node ID d5d2f40e13f857cb7602d5bb0c14abdb3f7c15f5
>> # Parent 7f368a4aff38e7c176c27d808a51d8be2d3b4c0b
>> # Available At http://hg.logilab.org/review/cubes/eac
>> # hg pull http://hg.logilab.org/review/cubes/eac -r d5d2f40e13f8
>> Add some attribute to EACRessourceRelation
>>
>> Add support for the <relationEntry> and xml attributes
>> for EACResourceRelation
> Can you explain the point of storing "attributes" in the SQL model?

The clients want to imports these values. And I was not advised to

make an object's attribute for every xml attribute.

>> diff -r 7f368a4aff38 -r d5d2f40e13f8 cubicweb_eac/dataimport.py
>> --- a/cubicweb_eac/dataimport.py Tue Jul 30 17:31:37 2019 +0200
>> +++ b/cubicweb_eac/dataimport.py Tue Jul 30 17:31:37 2019 +0200
>> @@ -890,6 +890,9 @@
>> 'resource_relation_resource': set([obj_uri]),
>> 'resource_relation_agent': set([self.record.extid]),
>> }
>> + relation_entry = self._elem_find(elem, 'eac:relationEntry')
>> + if relation_entry is not None:
>> + values['relation_entry'] = set([text_type(relation_entry.text)])
>> resource_role = elem.attrib.get('{%(xlink)s}role' % self.namespaces)
>> if resource_role:
>> values['resource_role'] = set([text_type(resource_role)])
>> @@ -900,6 +903,13 @@
>> if dates:
>> values.update(dates)
>> values.update(self.parse_tag_description(elem))
>> + attrib = {k: v for (k, v) in dict(elem.attrib).items() if k not in {
>> + 'relationRelationType',
>> + '{%(xlink)s}role' % self.namespaces,
>> + '{%(xlink)s}href' % self.namespaces,
>> + }}
>> + if attrib:
>> + values.update({'attributes': set([text_type(attrib)])})
> Same as for the other patch, please consider using .pop().
Roger.
>
>> yield ExtEntity('EACResourceRelation', self._gen_extid(), values)
>> @filter_none
>> diff -r 7f368a4aff38 -r d5d2f40e13f8 test/test_dataimport.py
>> --- a/test/test_dataimport.py Tue Jul 30 17:31:37 2019 +0200
>> +++ b/test/test_dataimport.py Tue Jul 30 17:31:37 2019 +0200
>> @@ -381,6 +381,8 @@
>> ),
>> ('EACResourceRelation', _gen_extid(),
>> {'agent_role': set([u'creatorOf']),
>> + 'attributes': set([u"{'{http://www.w3.org/1999/xlink}show': 'new', 
>> '{http://www.w3.org/1999/xlink}actuate': 'onRequest', 
>> '{http://www.w3.org/1999/xlink}type': 'simple', 
>> 'resourceRelationType': 'creatorOf'}"]), # noqa
> # noqa
>
> Can you please check your future patches about this?
Yes, sry fot that that changeset was not intended to be send in this state.
>> + 'relation_entry': set([u'Gironde. Conseil g\xe9n\xe9ral. Direction 
>> de l\'administration et de la s\xe9curit\xe9 juridique']),
>> 'resource_role': set([u'Fonds d\'archives']),
>> 'resource_relation_resource': set([
>> 'http://gael.gironde.fr/ead.html?id=FRAD033_IR_N']),
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/saem-devel/attachments/20190812/8c99a60d/attachment-0184.html>


More information about the saem-devel mailing list