[PATCH saem] [seda] Add 'ark:/' prefix to originating agency identifier in SEDA 0.2/10. export

Sylvain Thenault sylvain.thenault at logilab.fr
Thu Jun 22 11:40:30 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1498123799 -7200
#      Thu Jun 22 11:29:59 2017 +0200
# Node ID 9bfae8db1d1675df5cb19e14b3f5b2d8eddfee78
# Parent  48b3fe1177453dbeb1649f22895ae498b56ea08a
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 9bfae8db1d16
[seda] Add 'ark:/' prefix to originating agency identifier in SEDA 0.2/10. export


Closes extranet #26003592

diff --git a/cubicweb_saem_ref/entities/seda.py b/cubicweb_saem_ref/entities/seda.py
--- a/cubicweb_saem_ref/entities/seda.py
+++ b/cubicweb_saem_ref/entities/seda.py
@@ -51,11 +51,11 @@ def xsd_archival_agreement(self, parent,
 
 
 # override agency_id to return ark instead of eid
 @monkeypatch(SEDA1XSDExport)
 def agency_id(self, agency):
-    return None if agency.agency is None else agency.agency.ark
+    return None if agency.agency is None else 'ark:/' + agency.agency.ark
 
 
 SEDAArchiveTransferIClonableAdapter.__select__ &= is_in_state('published')
 SEDAArchiveTransferIClonableAdapter.rtype = 'new_version_of'
 SEDAArchiveTransferIClonableAdapter.skiprtypes += ('clone_of',)
diff --git a/test/test_seda.py b/test/test_seda.py
--- a/test/test_seda.py
+++ b/test/test_seda.py
@@ -90,10 +90,10 @@ class SEDAExportTC(CubicWebTC):
 
             # ensure we get the ark as agency identifier
             record = testutils.authority_record(cnx, u'DGSI')
             agency.cw_set(seda_originating_agency_to=record)
             for xml in self.iter_seda_xsd(transfer):
-                self.assertIn(record.ark, xml)
+                self.assertIn('ark:/' + record.ark, xml)
 
 
 if __name__ == '__main__':
     unittest.main()


More information about the saem-devel mailing list