[PATCH eac V2] Add new attributes to NameEntry

Guillaume Vandevelde guillaume.vandevelde at logilab.fr
Tue Aug 20 16:36:15 CEST 2019


# HG changeset patch
# User Guillaume Vandevelde <gvandevelde at logilab.fr>
# Date 1566290984 -7200
#      Tue Aug 20 10:49:44 2019 +0200
# Node ID 52b8ac3c441c1fe33d12b4c48132882516b20bb0
# Parent  b8b9f1980b1a4bda9c407d96b58da5d4d5318bb0
# Available At http://hg.logilab.org/review/cubes/eac
#              hg pull http://hg.logilab.org/review/cubes/eac -r 52b8ac3c441c
Add new attributes to NameEntry

diff -r b8b9f1980b1a -r 52b8ac3c441c cubicweb_eac/dataimport.py
--- a/cubicweb_eac/dataimport.py	Fri Aug 09 12:35:49 2019 +0200
+++ b/cubicweb_eac/dataimport.py	Tue Aug 20 10:49:44 2019 +0200
@@ -41,11 +41,12 @@
 TYPE_MAPPING['human'] = u'person'
 
 ETYPES_ORDER_HINT = ('AgentKind', 'PhoneNumber', 'PostalAddress', 'AuthorityRecord',
-                     'Convention', 'AgentPlace', 'Mandate',
-                     'LegalStatus', 'History', 'HistoricalEvent', 'Structure', 'AgentFunction',
-                     'Occupation', 'GeneralContext', 'AssociationRelation', 'ChronologicalRelation',
-                     'HierarchicalRelation', 'EACResourceRelation', 'EACFunctionRelation',
-                     'ExternalUri', 'EACSource', 'Activity')
+                     'Convention', 'AgentPlace',
+                     'Mandate', 'LegalStatus', 'History', 'HistoricalEvent', 'Structure',
+                     'AgentFunction', 'Occupation', 'GeneralContext', 'AssociationRelation',
+                     'ChronologicalRelation', 'HierarchicalRelation', 'EACResourceRelation',
+                     'EACFunctionRelation', 'ExternalUri', 'EACSource', 'Activity',
+                     'NameEntry')
 
 
 class InvalidEAC(RuntimeError):
diff -r b8b9f1980b1a -r 52b8ac3c441c cubicweb_eac/entities.py
--- a/cubicweb_eac/entities.py	Fri Aug 09 12:35:49 2019 +0200
+++ b/cubicweb_eac/entities.py	Tue Aug 20 10:49:44 2019 +0200
@@ -222,6 +222,16 @@
     fetch_attrs, cw_fetch_order = fetch_config(('event',))
 
 
+class NameEntry(AnyEntity):
+    __regid__ = 'NameEntry'
+    fetch_attrs, cw_fetch_order = fetch_config(('language',
+                                                'preferred_form',
+                                                'alternative_form',
+                                                'authorized_form',
+                                                'script_code',
+                                                'parts'))
+
+
 # XML export
 
 def substitute_xml_prefix(prefix_name, namespaces):
diff -r b8b9f1980b1a -r 52b8ac3c441c cubicweb_eac/migration/0.9.0_Any.py
--- a/cubicweb_eac/migration/0.9.0_Any.py	Fri Aug 09 12:35:49 2019 +0200
+++ b/cubicweb_eac/migration/0.9.0_Any.py	Tue Aug 20 10:49:44 2019 +0200
@@ -1,6 +1,15 @@
-add_attribute('History', 'abstract')
 add_entity_type('HistoricalEvent')
 add_entity_type('Convention')
 add_entity_type('EACFunctionRelation')
+
+# Attributes to update
 add_attribute('EACResourceRelation', 'xml_attributes')
 add_attribute('EACResourceRelation', 'relation_entry')
+
+add_attribute('History', 'abstract')
+
+for attrib in ('language', 'preferred_form',
+               'alternative_form', 'authorized_form',
+               'script_code'):
+    add_attribute('NameEntry', attrib)
+
diff -r b8b9f1980b1a -r 52b8ac3c441c cubicweb_eac/schema.py
--- a/cubicweb_eac/schema.py	Fri Aug 09 12:35:49 2019 +0200
+++ b/cubicweb_eac/schema.py	Tue Aug 20 10:49:44 2019 +0200
@@ -62,6 +62,18 @@
 
 class NameEntry(EntityType):
     """Represent a nameEntry tag of an EAC-CPF document."""
+    language = String(fulltextindexed=True,
+                      description=_('language in wich the name is written'))
+    preferred_form = String(fulltextindexed=True,
+                            description=_('indicate which of the NameEntry in a ParallelNames'
+                                          ' is the preferred one '))
+    alternative_form = String(fulltextindexed=True,
+                              description=_('indicate an alternative or variant forms'))
+    authorized_form = String(fulltextindexed=True,
+                             description=_('indicate the authorized form of the name '
+                                           'according to a different set of rules'))
+    script_code = String(fulltextindexed=True,
+                         description=_('language code of the language attribute'))
     parts = String(
         required=True, fulltextindexed=True,
         description=_('concatenation of part tags within a nameEntry'))



More information about the saem-devel mailing list