[PATCH eac V2] [entities] allow controlling export of recordId and otherRecordId

Philippe Pepiot philippe.pepiot at logilab.fr
Tue Feb 28 10:54:50 CET 2017


# HG changeset patch
# User Philippe Pepiot <philippe.pepiot at logilab.fr>
# Date 1488275276 -3600
#      Tue Feb 28 10:47:56 2017 +0100
# Node ID 4b544853003f00dabda3a18e1e2a69297834dfdc
# Parent  a7a2ad4e5cf2a4a266897b04defb9dbc90467844
# Available At https://hg.logilab.org/review/cubes/eac
#              hg pull https://hg.logilab.org/review/cubes/eac -r 4b544853003f
# Tested at: https://jenkins.logilab.org/job/cubicweb-eac/59/
[entities] allow controlling export of recordId and otherRecordId

This allow to control what will be written in <recordId> and <otherRecordId> by
inheriting AuthorityRecordEACAdapter.

Also remove useless six.text_type() cast on EACOtherRecordId.value which is already unicode.

Related to extranet #12572781

diff --git a/cubicweb_eac/entities.py b/cubicweb_eac/entities.py
--- a/cubicweb_eac/entities.py
+++ b/cubicweb_eac/entities.py
@@ -295,6 +295,15 @@ class AuthorityRecordEACAdapter(Abstract
 
     def control_element(self, eac_cpf_elt):
         control_elt = self.element('control', parent=eac_cpf_elt)
+        self.recordid_element(control_elt)
+        self.maintenance_status_element(control_elt)
+        self.publication_status_element(control_elt)
+        self.maintenance_agency_element(control_elt)
+        self.language_declaration_element(control_elt)
+        self.maintenance_history_element(control_elt)
+        self.sources_element(control_elt)
+
+    def recordid_element(self, control_elt):
         record_id = self.entity.record_id
         if record_id is None:
             record_id = text_type(self.entity.eid)
@@ -304,13 +313,7 @@ class AuthorityRecordEACAdapter(Abstract
             if local_type is not None:
                 attrs['localType'] = local_type
             self.element('otherRecordId', parent=control_elt, attributes=attrs,
-                         text=text_type(value))
-        self.maintenance_status_element(control_elt)
-        self.publication_status_element(control_elt)
-        self.maintenance_agency_element(control_elt)
-        self.language_declaration_element(control_elt)
-        self.maintenance_history_element(control_elt)
-        self.sources_element(control_elt)
+                         text=value)
 
     def cpfdescription_element(self, eac_cpf_elt):
         cpfdescription_elt = self.element('cpfDescription', parent=eac_cpf_elt)



More information about the saem-devel mailing list