[PATCH eac V3] Add support for <chronList> under <biogHist> tag

Denis Laxalde denis.laxalde at logilab.fr
Wed Jul 31 12:41:06 CEST 2019


Guillaume Vandevelde a écrit :
> # HG changeset patch
> # User Guillaume Vandevelde <gvandevelde at logilab.fr>
> # Date 1563546183 -7200
> #      Fri Jul 19 16:23:03 2019 +0200
> # Node ID 8d8cb026854adef808130ac78f1efa0e83d3e639
> # Parent  c6719ba14ca67516c6f2bd932fe562c2a593e376
> # Available At http://hg.logilab.org/review/cubes/eac
> #              hg pull http://hg.logilab.org/review/cubes/eac -r 8d8cb026854a
> Add support for <chronList> under <biogHist> tag
> 
> Build a new Event entities as child of the History entity.
> 
> Added as a new entity for handling the case of multiples events under a <biogHist> tag.
> Modified the `add_citation_for` decorator so it can handle any child appending.
> Modified the History child creation and concatenation so it can use this system.

It'be nice if you could actually write sentences in the body part of the
commit message. As is, it's pretty hard to understand for me.

> diff -r c6719ba14ca6 -r 8d8cb026854a cubicweb_eac/i18n/fr.po
> --- a/cubicweb_eac/i18n/fr.po	Thu Jul 04 15:10:27 2019 +0200
> +++ b/cubicweb_eac/i18n/fr.po	Fri Jul 19 16:23:03 2019 +0200
> @@ -129,6 +129,9 @@
>  msgid "EACSource_plural"
>  msgstr "Sources"
>  
> +msgid "Events linked to an History object"
> +msgstr "Événements liées à un segment d'histoire"
> +
>  msgid "GeneralContext"
>  msgstr "Contexte général"
>  
> @@ -144,6 +147,15 @@
>  msgid "HierarchicalRelation_plural"
>  msgstr "Relations hiérarchiques"
>  
> +msgid "HistoricalEvent"
> +msgstr "Événement historique"
> +
> +msgid "HistoricalEvent with date for describing an historical event"
> +msgstr "Événement historique avec une date"
> +
> +msgid "HistoricalEvent_plural"
> +msgstr "ÉvénementS historiqueS"

Why those big "S"?

> +
>  msgid "History"
>  msgstr "Élément d'information historique"


> diff -r c6719ba14ca6 -r 8d8cb026854a cubicweb_eac/schema.py
> --- a/cubicweb_eac/schema.py	Thu Jul 04 15:10:27 2019 +0200
> +++ b/cubicweb_eac/schema.py	Fri Jul 19 16:23:03 2019 +0200
> @@ -265,6 +265,22 @@
>      text = RichString(fulltextindexed=True)
>  
>  
> + at dated_entity_type
> +class HistoricalEvent(EntityType):
> +    """Events linked to an History object"""
> +    event = RichString(fulltextindexed=True)
> +    place_entry = String(fulltextindexed=True)

Is this place_entry attribute actually used?

> +
> +
> +class has_event(RelationDefinition):
> +    subject = 'History'
> +    object = 'HistoricalEvent'
> +    cardinality = '*1'
> +    composite = 'subject'
> +    fulltext_container = 'subject'
> +    description = _('HistoricalEvent with date for describing an historical event')
> +
> +
>  class Structure(EntityType):
>      """Information about the structure of an authority"""
>      description = RichString(fulltextindexed=True)

> diff -r c6719ba14ca6 -r 8d8cb026854a test/test_dataimport.py
> --- a/test/test_dataimport.py	Thu Jul 04 15:10:27 2019 +0200
> +++ b/test/test_dataimport.py	Fri Jul 19 16:23:03 2019 +0200
> @@ -182,7 +182,8 @@
>               },
>              ),
>              ('History', _gen_extid(),
> -             {'text': set(["\n".join((
> +             {'abstract': set([u'Test of an abstract element']),
> +              'text': set(["\n".join((
>                       u'<p xmlns="urn:isbn:1-931666-33-4" '
>                       u'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
>                       u'xmlns:xlink="http://www.w3.org/1999/xlink">{0}</p>'
> @@ -192,7 +193,7 @@
>                'text_format': set([u'text/html']),
>                'history_agent': set(['FRAD033_EAC_00001']),
>                'has_citation': set(['16', '17']),
> -              'abstract': set([u'Test of an abstract element']),
> +              'has_event': set(['18', '19']),
>               },
>              ),
>              ('Citation', _gen_extid(),
> @@ -201,6 +202,16 @@
>              ('Citation', _gen_extid(),
>               {'uri': set(['http://pifgadget']), 'note': set(['Voir aussi pifgadget'])},
>              ),
> +            ('HistoricalEvent', _gen_extid(),
> +             {'event': [u'Left Mer and moved to the mainland.\n\t      Worked at various jobs including canecutter\n\t      and railway labourer.\n\t      '], # noqa

Can you avoid # noqa and break the string?


> +              'end_date': set([datetime.date(1957, 1, 1)]),
> +              'start_date': set([datetime.date(1957, 1, 1)])}
> +            ),
> +            ('HistoricalEvent', _gen_extid(),
> +             {'event': set([u'Union representative, Townsville-\n\t      Mount Isa rail construction project.\n\t      ']), # noqa

Same here.

> +              'end_date': set([datetime.date(1961, 1, 1)]),
> +              'start_date': set([datetime.date(1960, 1, 1)])}
> +            ),
>              ('Structure', _gen_extid(),
>               {'description': set([u'<p xmlns="urn:isbn:1-931666-33-4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">Pour accomplir ses missions ...</p>']),  # noqa
>                'description_format': set([u'text/html']),
> @@ -238,7 +249,7 @@
>                'description': set([u'Organisation des réunions ...']),
>                'description_format': set([u'text/plain']),
>                'occupation_agent': set(['FRAD033_EAC_00001']),
> -              'has_citation': set(['23']),
> +              'has_citation': set(['25']),
>                'equivalent_concept': set(['http://pifgadget.com']),
>               },
>              ),
> @@ -251,7 +262,7 @@
>                                u'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
>                                u'xmlns:xlink="http://www.w3.org/1999/xlink">very famous</p>']),
>                'content_format': set([u'text/html']),
> -              'has_citation': set(['25']),
> +              'has_citation': set(['27']),
>                'general_context_of': set(['FRAD033_EAC_00001']),
>                }
>              ),
> @@ -335,7 +346,7 @@
>              ('ExternalUri', 'http://catalogue.bnf.fr/ark:/12148/cb152418385',
>               {'uri': set([u'http://catalogue.bnf.fr/ark:/12148/cb152418385']),
>                'cwuri': set([u'http://catalogue.bnf.fr/ark:/12148/cb152418385'])},
> -            ),
> +           ),

Unrelated hunk?

>              ('ExternalUri', 'http://pifgadget.com',
>               {'uri': set([u'http://pifgadget.com']),
>                'cwuri': set([u'http://pifgadget.com'])},
> @@ -367,7 +378,7 @@
>                            'localControl': set([54]),
>                            'source': set([76]),  # empty.
>                            'structureOrGenealogy': set([189]),  # empty.
> -                          'biogHist': set([205, 208]),  # empty.
> +                          'biogHist': set([229, 232]),  # empty.
>                            })
>  
>      def test_mandate_under_mandates(self):
> @@ -465,7 +476,7 @@
>                                 cwuri=u'http://data.culture.fr/thesaurus/page/ark:/67717/T1-1074')
>              cnx.commit()
>              created, updated = testutils.eac_import(cnx, fpath)
> -            self.assertEqual(len(created), 39)
> +            self.assertEqual(len(created), 41)
>              self.assertEqual(updated, set())
>              rset = cnx.find('AuthorityRecord', isni=u'22330001300016')
>              self.assertEqual(len(rset), 1)
> @@ -509,6 +520,8 @@
>          self.assertEqual(entity.printable_value('text',
>                                                  format=u'text/plain').strip(),
>                           u"La loi du 22 décembre 1789, en divisant ...\n\nL'inspecteur Canardo")
> +        events = rset.one().has_event
> +        self.assertEqual(len(events), 2)
>  
>      def _check_mandate(self, cnx, record):
>          rset = cnx.find('Mandate', mandate_agent=record)



More information about the saem-devel mailing list