[PATCH 1 of 2 eac] Filter input values in the agent_type attribute of Activity

Frank Bessou frank.bessou at logilab.fr
Wed Aug 28 15:18:27 CEST 2019


Added a small description to the commit message and applied this one.

On 28/08/2019 15:00, Guillaume Vandevelde wrote:
> # HG changeset patch
> # User Guillaume Vandevelde <gvandevelde at logilab.fr>
> # Date 1566996229 -7200
> #      Wed Aug 28 14:43:49 2019 +0200
> # Node ID 35185252332b858d716f3eb5c82051f8ead90aa9
> # Parent  68455963c0baca0bc8f59a2c2a1dc10a2d1b28c9
> # Available At http://hg.logilab.org/review/cubes/eac
> #              hg pull http://hg.logilab.org/review/cubes/eac -r 35185252332b
> Filter input values in the agent_type attribute of Activity
> 
> diff -r 68455963c0ba -r 35185252332b cubicweb_eac/dataimport.py
> --- a/cubicweb_eac/dataimport.py	Mon Jul 01 16:49:26 2019 +0200
> +++ b/cubicweb_eac/dataimport.py	Wed Aug 28 14:43:49 2019 +0200
> @@ -1067,8 +1067,11 @@
>                       values['start'] = set([event_date])
>                       values['end'] = set([event_date])
>           values.update(self.parse_tag_description(elem, 'eac:eventDescription'))
> -        values.update(self.values_from_xpaths(elem, (('agent', 'eac:agent'),
> -                                                     ('agent_type', 'eac:agentType'))))
> +        values.update(self.values_from_xpaths(elem, (('agent', 'eac:agent'),)))
> +        agent_type = self._elem_find(elem, 'eac:agentType')
> +        values['agent_type'] = u'unknown'
> +        if agent_type.text in {'human', 'machine'}:
> +            values['agent_type'] = set([text_type(agent_type.text)])
>           yield ExtEntity('Activity', self._gen_extid(), values)
>   
>       @relate_to_record_through('Convention', 'convention_of')
> 

-- 
Frank Bessou
Logilab         https://www.logilab.fr



More information about the saem-devel mailing list