[profile gen] Fix position of the Description element in SEDA 0.2/1.0 exports
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 01 Jun 2017 07:32:30 +0200
changeset 2641 839f7bdebb14
parent 2639 5cda167cef43
child 2642 e9adbbfa204f
[profile gen] Fix position of the Description element in SEDA 0.2/1.0 exports It should appears first for SEDA 1.0 and after custodial history in SEDA 0.2. Update export test accordingly and add Description to SEDA 0.2 validation test. Closes extranet #23707701
cubicweb_seda/entities/profile_generation.py
test/data/seda_02_bordereau_ref.xml
test/data/seda_02_export.rng
test/data/seda_02_export.xsd
test/data/seda_1_export.rng
test/data/seda_1_export.xsd
test/test_profile_generation.py
--- a/cubicweb_seda/entities/profile_generation.py	Thu Jun 01 07:23:21 2017 +0200
+++ b/cubicweb_seda/entities/profile_generation.py	Thu Jun 01 07:32:30 2017 +0200
@@ -970,10 +970,10 @@
         """Append XSD elements for a description content to the given parent node"""
         cd_node = self.element_schema(parent, 'ContentDescription',
                                       xsd_attributes=[XAttr('Id', 'xsd:ID')])
+        self.xsd_description(cd_node, content)
         self.xsd_description_level(cd_node, content.description_level_concept)
         self.xsd_language(cd_node, content)
         self.xsd_content_dates(cd_node, content)
-        self.xsd_description(cd_node, content)
         self.xsd_custodial_history(cd_node, content)
         self.xsd_keywords(cd_node, content)
         self.xsd_originating_agency(cd_node, content)
@@ -1204,9 +1204,9 @@
         cd_node = self.element_schema(parent, 'ContentDescription',
                                       xsd_attributes=[XAttr('Id', 'xsd:ID')])
         self.xsd_custodial_history(cd_node, content)
+        self.xsd_description(cd_node, content)
         self.xsd_language(cd_node, content)
         self.xsd_content_dates(cd_node, content)
-        self.xsd_description(cd_node, content)
         self.xsd_originating_agency(cd_node, content)
         self.xsd_keywords(cd_node, content)
 
--- a/test/data/seda_02_bordereau_ref.xml	Thu Jun 01 07:23:21 2017 +0200
+++ b/test/data/seda_02_bordereau_ref.xml	Thu Jun 01 07:32:30 2017 +0200
@@ -37,6 +37,7 @@
       <Name>Kesso</Name>
       <TransferringAgencyObjectIdentifier>75241/a000000040</TransferringAgencyObjectIdentifier>
       <ContentDescription>
+        <Description>Acte n°1234</Description>
         <Language listVersionID="edition 2009">fr</Language>
         <LatestDate>2009-07-14</LatestDate>
         <OldestDate>2009-07-14</OldestDate>
--- a/test/data/seda_02_export.rng	Thu Jun 01 07:23:21 2017 +0200
+++ b/test/data/seda_02_export.rng	Thu Jun 01 07:32:30 2017 +0200
@@ -206,6 +206,16 @@
                 <rng:data type="string"/>
               </rng:element>
             </rng:optional>
+            <rng:optional>
+              <rng:element name="Description">
+                <rng:optional>
+                  <rng:attribute name="languageID">
+                    <rng:data type="language"/>
+                  </rng:attribute>
+                </rng:optional>
+                <rng:data type="string"/>
+              </rng:element>
+            </rng:optional>
             <rng:element name="Language">
               <rng:attribute name="listVersionID">
                 <rng:value type="token">edition 2009</rng:value>
@@ -223,16 +233,6 @@
               </rng:element>
             </rng:optional>
             <rng:optional>
-              <rng:element name="Description">
-                <rng:optional>
-                  <rng:attribute name="languageID">
-                    <rng:data type="language"/>
-                  </rng:attribute>
-                </rng:optional>
-                <rng:data type="string"/>
-              </rng:element>
-            </rng:optional>
-            <rng:optional>
               <rng:element name="OriginatingAgency">
                 <rng:element name="Identification">
                   <rng:optional>
--- a/test/data/seda_02_export.xsd	Thu Jun 01 07:23:21 2017 +0200
+++ b/test/data/seda_02_export.xsd	Thu Jun 01 07:32:30 2017 +0200
@@ -148,6 +148,15 @@
                         </xsd:simpleContent>
                       </xsd:complexType>
                     </xsd:element>
+                    <xsd:element minOccurs="0" name="Description">
+                      <xsd:complexType>
+                        <xsd:simpleContent>
+                          <xsd:extension base="udt:TextType">
+                            <xsd:attribute name="languageID" type="xsd:language" use="optional"/>
+                          </xsd:extension>
+                        </xsd:simpleContent>
+                      </xsd:complexType>
+                    </xsd:element>
                     <xsd:element name="Language">
                       <xsd:complexType>
                         <xsd:simpleContent>
@@ -159,15 +168,6 @@
                     </xsd:element>
                     <xsd:element minOccurs="0" name="LatestDate" type="udt:DateType"/>
                     <xsd:element minOccurs="0" name="OldestDate" type="udt:DateType"/>
-                    <xsd:element minOccurs="0" name="Description">
-                      <xsd:complexType>
-                        <xsd:simpleContent>
-                          <xsd:extension base="udt:TextType">
-                            <xsd:attribute name="languageID" type="xsd:language" use="optional"/>
-                          </xsd:extension>
-                        </xsd:simpleContent>
-                      </xsd:complexType>
-                    </xsd:element>
                     <xsd:element minOccurs="0" name="OriginatingAgency">
                       <xsd:complexType>
                         <xsd:sequence>
--- a/test/data/seda_1_export.rng	Thu Jun 01 07:23:21 2017 +0200
+++ b/test/data/seda_1_export.rng	Thu Jun 01 07:32:30 2017 +0200
@@ -164,6 +164,16 @@
                 <rng:data type="ID"/>
               </rng:attribute>
             </rng:optional>
+            <rng:optional>
+              <rng:element name="Description">
+                <rng:optional>
+                  <rng:attribute name="languageID">
+                    <rng:data type="language"/>
+                  </rng:attribute>
+                </rng:optional>
+                <rng:data type="string"/>
+              </rng:element>
+            </rng:optional>
             <rng:element name="DescriptionLevel">
               <rng:attribute name="listVersionID">
                 <rng:value type="token">edition 2009</rng:value>
@@ -187,16 +197,6 @@
               </rng:element>
             </rng:optional>
             <rng:optional>
-              <rng:element name="Description">
-                <rng:optional>
-                  <rng:attribute name="languageID">
-                    <rng:data type="language"/>
-                  </rng:attribute>
-                </rng:optional>
-                <rng:data type="string"/>
-              </rng:element>
-            </rng:optional>
-            <rng:optional>
               <rng:element name="CustodialHistory">
                 <rng:optional>
                   <rng:element name="CustodialHistoryItem">
--- a/test/data/seda_1_export.xsd	Thu Jun 01 07:23:21 2017 +0200
+++ b/test/data/seda_1_export.xsd	Thu Jun 01 07:32:30 2017 +0200
@@ -99,6 +99,15 @@
               <xsd:element name="ContentDescription">
                 <xsd:complexType>
                   <xsd:sequence>
+                    <xsd:element minOccurs="0" name="Description">
+                      <xsd:complexType>
+                        <xsd:simpleContent>
+                          <xsd:extension base="udt:TextType">
+                            <xsd:attribute name="languageID" type="xsd:language" use="optional"/>
+                          </xsd:extension>
+                        </xsd:simpleContent>
+                      </xsd:complexType>
+                    </xsd:element>
                     <xsd:element fixed="file" name="DescriptionLevel">
                       <xsd:complexType>
                         <xsd:simpleContent>
@@ -119,15 +128,6 @@
                     </xsd:element>
                     <xsd:element minOccurs="0" name="LatestDate" type="udt:DateType"/>
                     <xsd:element minOccurs="0" name="OldestDate" type="udt:DateType"/>
-                    <xsd:element minOccurs="0" name="Description">
-                      <xsd:complexType>
-                        <xsd:simpleContent>
-                          <xsd:extension base="udt:TextType">
-                            <xsd:attribute name="languageID" type="xsd:language" use="optional"/>
-                          </xsd:extension>
-                        </xsd:simpleContent>
-                      </xsd:complexType>
-                    </xsd:element>
                     <xsd:element minOccurs="0" name="CustodialHistory">
                       <xsd:complexType>
                         <xsd:sequence>
--- a/test/test_profile_generation.py	Thu Jun 01 07:23:21 2017 +0200
+++ b/test/test_profile_generation.py	Thu Jun 01 07:32:30 2017 +0200
@@ -897,6 +897,7 @@
                    seda_transferring_agency_archive_unit_identifier=subunit_alt_seq)
             create('SEDAStartDate', seda_start_date=subunit_alt_seq)
             create('SEDAEndDate', seda_end_date=subunit_alt_seq)
+            create('SEDADescription', seda_description=subunit_alt_seq)
             kw = create('SEDAKeyword', user_cardinality=u'0..n', seda_keyword=subunit_alt_seq)
             create('SEDAKeywordReference', seda_keyword_reference_from=kw)