[PATCH 02 of 11 seda] [SEDA 2.1] Drop no more needed reply code list version

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Mar 3 10:43:14 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1488532755 -3600
#      Fri Mar 03 10:19:15 2017 +0100
# Node ID 83e093bfa6b9e2462d5e6f925b466177402a8464
# Parent  f9ce0269a69b8a93200296edbe19c8266d02242b
[SEDA 2.1] Drop no more needed reply code list version

it's not required anymore and doesn't apply to transfer request
(To be confirmed by Baptiste)

diff --git a/cubicweb_seda/i18n/en.po b/cubicweb_seda/i18n/en.po
--- a/cubicweb_seda/i18n/en.po
+++ b/cubicweb_seda/i18n/en.po
@@ -6791,24 +6791,10 @@ msgstr ""
 
 msgctxt "SEDASeqAltArchiveUnitArchiveUnitRefIdManagement"
 msgid "seda_replaces_object"
 msgstr ""
 
-msgid "seda_reply_code_list_version"
-msgstr ""
-
-msgctxt "SEDAArchiveTransfer"
-msgid "seda_reply_code_list_version"
-msgstr ""
-
-msgid "seda_reply_code_list_version_object"
-msgstr ""
-
-msgctxt "ConceptScheme"
-msgid "seda_reply_code_list_version_object"
-msgstr ""
-
 msgid "seda_repository_archive_unit_pid"
 msgstr ""
 
 msgctxt "SEDARepositoryArchiveUnitPID"
 msgid "seda_repository_archive_unit_pid"
diff --git a/cubicweb_seda/i18n/fr.po b/cubicweb_seda/i18n/fr.po
--- a/cubicweb_seda/i18n/fr.po
+++ b/cubicweb_seda/i18n/fr.po
@@ -6812,24 +6812,10 @@ msgstr "objet remplacé"
 
 msgctxt "SEDASeqAltArchiveUnitArchiveUnitRefIdManagement"
 msgid "seda_replaces_object"
 msgstr ""
 
-msgid "seda_reply_code_list_version"
-msgstr "codes de réponse"
-
-msgctxt "SEDAArchiveTransfer"
-msgid "seda_reply_code_list_version"
-msgstr ""
-
-msgid "seda_reply_code_list_version_object"
-msgstr ""
-
-msgctxt "ConceptScheme"
-msgid "seda_reply_code_list_version_object"
-msgstr ""
-
 msgid "seda_repository_archive_unit_pid"
 msgstr ""
 
 msgctxt "SEDARepositoryArchiveUnitPID"
 msgid "seda_repository_archive_unit_pid"
diff --git a/cubicweb_seda/migration/0.8.0_Any.py b/cubicweb_seda/migration/0.8.0_Any.py
new file mode 100644
--- /dev/null
+++ b/cubicweb_seda/migration/0.8.0_Any.py
@@ -0,0 +1,1 @@
+drop_relation_type('seda_reply_code_list_version')
diff --git a/cubicweb_seda/schema/seda2.py b/cubicweb_seda/schema/seda2.py
--- a/cubicweb_seda/schema/seda2.py
+++ b/cubicweb_seda/schema/seda2.py
@@ -125,19 +125,10 @@ class archive_transfer_transferring_agen
     cardinality = '?*'
     composite = fulltext_container = None
     inlined = True
     constraints = []
 
-class archive_transfer_reply_code_list_version(RelationDefinition):
-    name = 'seda_reply_code_list_version'
-    subject = 'SEDAArchiveTransfer'
-    object = 'ConceptScheme'
-    cardinality = '?*'
-    composite = fulltext_container = None
-    inlined = True
-    constraints = []
-
 class archive_transfer_message_digest_algorithm_code_list_version(RelationDefinition):
     name = 'seda_message_digest_algorithm_code_list_version'
     subject = 'SEDAArchiveTransfer'
     object = 'ConceptScheme'
     cardinality = '?*'
diff --git a/cubicweb_seda/views/uicfg.py b/cubicweb_seda/views/uicfg.py
--- a/cubicweb_seda/views/uicfg.py
+++ b/cubicweb_seda/views/uicfg.py
@@ -172,12 +172,10 @@ abaa.tag_subject_of(('*', 'seda_transfer
 abaa.tag_object_of(('*', 'seda_transfer_request_reply_identifier', '*'), False)
 abaa.tag_object_of(('*', 'seda_archival_agency', '*'), False)
 abaa.tag_subject_of(('*', 'seda_archival_agency', '*'), False)
 abaa.tag_object_of(('*', 'seda_transferring_agency', '*'), False)
 abaa.tag_subject_of(('*', 'seda_transferring_agency', '*'), False)
-abaa.tag_object_of(('*', 'seda_reply_code_list_version', '*'), False)
-abaa.tag_subject_of(('*', 'seda_reply_code_list_version', '*'), False)
 abaa.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), False)
 abaa.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), False)
 abaa.tag_subject_of(('*', 'seda_mime_type_code_list_version_from', '*'), False)
 abaa.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), False)
 abaa.tag_object_of(('*', 'seda_mime_type_code_list_version_to', '*'), False)
@@ -583,12 +581,10 @@ afs.tag_subject_of(('*', 'seda_transfer_
 afs.tag_object_of(('*', 'seda_transfer_request_reply_identifier', '*'), 'main', 'inlined')
 afs.tag_object_of(('*', 'seda_archival_agency', '*'), 'main', 'hidden')
 afs.tag_subject_of(('*', 'seda_archival_agency', '*'), 'main', 'attributes')
 afs.tag_object_of(('*', 'seda_transferring_agency', '*'), 'main', 'hidden')
 afs.tag_subject_of(('*', 'seda_transferring_agency', '*'), 'main', 'attributes')
-afs.tag_object_of(('*', 'seda_reply_code_list_version', '*'), 'main', 'hidden')
-afs.tag_subject_of(('*', 'seda_reply_code_list_version', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'main', 'hidden')
 afs.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'main', 'hidden')
 afs.tag_subject_of(('*', 'seda_mime_type_code_list_version_from', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'seda_mime_type_code_list_version_to', '*'), 'main', 'hidden')
@@ -938,12 +934,10 @@ afs.tag_object_of(('*', 'seda_repository
 pvs = uicfg.primaryview_section
 pvs.tag_subject_of(('*', 'seda_related_transfer_reference', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_related_transfer_reference', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_archival_agency', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_transferring_agency', '*'), 'hidden')
-pvs.tag_object_of(('*', 'seda_reply_code_list_version', '*'), 'hidden')
-pvs.tag_subject_of(('*', 'seda_reply_code_list_version', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'hidden')
 pvs.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'hidden')
 pvs.tag_subject_of(('*', 'seda_mime_type_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_mime_type_code_list_version_to', '*'), 'hidden')
@@ -1114,11 +1108,10 @@ rec.tag_object_of(('*', 'seda_signature'
 rec.tag_subject_of(('*', 'archival_agreement', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_object_of(('*', 'seda_archival_agreement', '*'), {'novalue_label': ' '})
 rec.tag_object_of(('*', 'seda_transfer_request_reply_identifier', '*'), {'novalue_label': ' '})
 rec.tag_subject_of(('*', 'seda_archival_agency', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_subject_of(('*', 'seda_transferring_agency', '*'), {'novalue_label': '<no value specified>'})
-rec.tag_subject_of(('*', 'seda_reply_code_list_version', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), {'novalue_label': ' '})
 rec.tag_subject_of(('*', 'seda_mime_type_code_list_version_to', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_object_of(('*', 'seda_encoding_code_list_version_from', '*'), {'novalue_label': ' '})
 rec.tag_subject_of(('*', 'seda_encoding_code_list_version_to', '*'), {'novalue_label': '<no value specified>'})
diff --git a/cubicweb_seda/xsd.py b/cubicweb_seda/xsd.py
--- a/cubicweb_seda/xsd.py
+++ b/cubicweb_seda/xsd.py
@@ -43,10 +43,11 @@ SKIP_ELEMENTS = set([
     'OtherManagementAbstract',
     'OtherCoreTechnicalMetadataAbstract',
     'OtherDimensionsAbstract',
     'OtherCodeListAbstract',
     'AuthorizationReasonCodeListVersion',  # not for ArchiveTransfer
+    'ReplyCodeListVersion',  # not for ArchiveTransfer
     ('Content', 'Signature'),  # keep signature on ArchiveTransfer, skip it on content
 ])
 JUMP_ELEMENTS = set([
     # ArchiveTransfer
     'CodeListVersions',
@@ -164,11 +165,10 @@ XSD2YAMS = {
     'CompressionAlgorithmCodeListVersion': 'ConceptScheme',
     'FileFormatCodeListVersion': 'ConceptScheme',
     'EncodingCodeListVersion': 'ConceptScheme',
     'MimeTypeCodeListVersion': 'ConceptScheme',
     'MessageDigestAlgorithmCodeListVersion': 'ConceptScheme',
-    'ReplyCodeListVersion': 'ConceptScheme',
 }
 
 
 def un_camel_case(name):
     """Turn CamelCased name into a lower-underscored name (camel_case)."""
diff --git a/cubicweb_seda/xsd/seda-2.0-main.xsd b/cubicweb_seda/xsd/seda-2.0-main.xsd
--- a/cubicweb_seda/xsd/seda-2.0-main.xsd
+++ b/cubicweb_seda/xsd/seda-2.0-main.xsd
@@ -47,11 +47,11 @@
         </xsd:sequence>
     </xsd:group>
     <!-- Reply Code list -->
     <xsd:group name="ReplyCodeListGroup">
         <xsd:sequence>
-            <xsd:element name="ReplyCodeListVersion" type="CodeType">
+            <xsd:element name="ReplyCodeListVersion" type="CodeType" minOccurs="0">
                 <xsd:annotation>
                     <xsd:documentation>Liste des codes de réponses à utiliser.</xsd:documentation>
                 </xsd:annotation>
             </xsd:element>
         </xsd:sequence>
diff --git a/test/data/BV2.0_min.xml b/test/data/BV2.0_min.xml
--- a/test/data/BV2.0_min.xml
+++ b/test/data/BV2.0_min.xml
@@ -7,11 +7,10 @@
     <MessageIdentifier/>
     <!-- <Signature></Signature> -->
     <!-- <ArchivalAgreement>Note d'information relative au versement de la matrice cadastrale de -->
     <!--     l'année 2004 aux services départementaux d'archives DGP/SIAF/2015/</ArchivalAgreement> -->
     <CodeListVersions>
-        <ReplyCodeListVersion>ReplyCode</ReplyCodeListVersion>
         <MessageDigestAlgorithmCodeListVersion>{mda_scheme_url}</MessageDigestAlgorithmCodeListVersion>
         <FileFormatCodeListVersion>FileFormat</FileFormatCodeListVersion>
     </CodeListVersions>
     <DataObjectPackage>
         <BinaryDataObject id="Bin1">
diff --git a/test/test_html_generation.py b/test/test_html_generation.py
--- a/test/test_html_generation.py
+++ b/test/test_html_generation.py
@@ -98,11 +98,11 @@ class SEDAHTMLExportFuncTC(SEDAExportFun
                 AttrDef(label='when', card='optional', value=None),
                 AttrDef(label='uri', card='optional', value=None),
             ]))
             # ensure jumped element children have proper parent
             clv = self.get_element(profile, 'CodeListVersions')
-            self.assertEqual(len(self.xpath(clv, 'div/h3[text()="ReplyCodeListVersion"]')), 1)
+            self.assertEqual(len(self.xpath(clv, 'div/h3[text()="MimeTypeCodeListVersion"]')), 1)
             # ensure KeywordType list handling
             ktype = self.get_element(profile, 'KeywordType')
             el_defs = self.element_values(ktype)
             self.assertEqual(el_defs, [{'label': 'listVersionID', 'value': 'edition 2009'},
                                        {'label': 'XSD content type', 'value': 'xsd:token'}])
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
@@ -535,13 +535,12 @@ class SEDA2ExportTCMixIn(object):
             self.assertElementDefinition(mt_clv, {'name': 'MimeTypeCodeListVersion',
                                                   'fixed': scheme.absolute_url(),
                                                   'type': 'xsd:token',
                                                   'minOccurs': '0'})
             # XXX also fix listSchemeURI ?
-            sample_clv = self.get_element(profile, 'ReplyCodeListVersion')
             self.assertXSDAttributes(
-                sample_clv,
+                mt_clv,
                 [{'name': 'listAgencyID', 'use': 'optional', 'type': 'xsd:token'},
                  {'name': 'listAgencyName', 'use': 'optional', 'type': 'xsd:string'},
                  {'name': 'listID', 'use': 'optional', 'type': 'xsd:token'},
                  {'name': 'listName', 'use': 'optional', 'type': 'xsd:string'},
                  {'name': 'listSchemeURI', 'use': 'optional', 'type': 'xsd:anyURI'},
diff --git a/test/test_schema.py b/test/test_schema.py
--- a/test/test_schema.py
+++ b/test/test_schema.py
@@ -38,12 +38,11 @@ class SchemaConceptConstraintsTC(CubicWe
             self.enc_concept = enc_concept.eid
 
     def test_code_lists_constraints_simple(self):
         with self.admin_access.client_cnx() as cnx:
             bdo = testutils.create_transfer_to_bdo(cnx)
-            bdo.container[0].cw_set(seda_reply_code_list_version=self.mt_scheme,
-                                    seda_message_digest_algorithm_code_list_version=self.enc_scheme)
+            bdo.container[0].cw_set(seda_message_digest_algorithm_code_list_version=self.enc_scheme)
             cnx.commit()
 
             bdo.cw_set(seda_algorithm=self.mt_concept)
             with self.assertRaises(ValidationError) as cm:
                 cnx.commit()


More information about the saem-devel mailing list