[PATCH 2 of 3 seda] [profile generation] Fix concept language used in case of SEDA 0.2 export

Sylvain Thenault sylvain.thenault at logilab.fr
Thu Aug 24 16:24:30 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1503584616 -7200
#      Thu Aug 24 16:23:36 2017 +0200
# Node ID 3572864fe580c941ec9bc960e2fd058069c41074
# Parent  21de2d5db25611a963b4e0edb1962db1f096caab
# Available At https://hg.logilab.org/review/cubes/seda
#              hg pull https://hg.logilab.org/review/cubes/seda -r 3572864fe580
[profile generation] Fix concept language used in case of SEDA 0.2 export

We should override the concepts_language class attribute else we'll use the
inherited 'seda-1' language.

diff --git a/cubicweb_seda/entities/profile_generation.py b/cubicweb_seda/entities/profile_generation.py
--- a/cubicweb_seda/entities/profile_generation.py
+++ b/cubicweb_seda/entities/profile_generation.py
@@ -1128,10 +1128,12 @@ class SEDA02XSDExport(SEDA1XSDExport):
 
     root_attributes = SEDA1XSDExport.root_attributes.copy()
     root_attributes['targetNamespace'] = 'fr:gouv:ae:archive:draft:standard_echange_v0.2'
     root_attributes['version'] = '1.1'
 
+    concepts_language = 'seda-02'
+
     def xsd_transfer(self, parent, archive_transfer):
         """Append XSD elements for the archive transfer to the given parent node."""
         transfer_node = self.xsd_transfer_base(parent, archive_transfer)
 
         for data_object in archive_transfer.binary_data_objects:
diff --git a/test/test_profile_generation.py b/test/test_profile_generation.py
--- a/test/test_profile_generation.py
+++ b/test/test_profile_generation.py
@@ -21,10 +21,11 @@ writing of generated content back to the
 
 from doctest import Example
 from itertools import chain, izip, repeat
 import os
 from os.path import basename, join
+import unittest
 
 from six import binary_type, text_type
 
 from lxml import etree
 from lxml.doctestcompare import LXMLOutputChecker
@@ -915,8 +916,14 @@ class OldSEDARNGExportTC(RelaxNGTestMixi
 
             root = self.profile_etree(transfer, 'SEDA-0.2.rng')
         self.check_xsd_profile(root, self.datapath('seda_02_bordereau_ref.xml'))
 
 
+class SEDAExportUnitTest(unittest.TestCase):
+
+    def test_concepts_languages(self):
+        self.assertEqual(pg.SEDA1XSDExport.concepts_language, 'seda-1')
+        self.assertEqual(pg.SEDA02XSDExport.concepts_language, 'seda-02')
+
+
 if __name__ == '__main__':
-    import unittest
     unittest.main()


More information about the saem-devel mailing list