[PATCH saem_ref V2] [eac] Replace ark's / by - in filename as well

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Mar 14 10:39:50 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1489075398 -3600
#      Thu Mar 09 17:03:18 2017 +0100
# Node ID 4b7568306673b01e65160fb7a3a852b6baec5ce7
# Parent  7f4f49b84a18866eab65c057d95ac98ae4322163
[eac] Replace ark's / by - in filename as well

for consistency with recordId.

diff --git a/cubicweb_saem_ref/entities/eac.py b/cubicweb_saem_ref/entities/eac.py
--- a/cubicweb_saem_ref/entities/eac.py
+++ b/cubicweb_saem_ref/entities/eac.py
@@ -41,11 +41,11 @@ class AuthorityRecordEACAdapter(eac.Auth
 
     @property
     def file_name(self):
         """Return a file name for the dump."""
         if self.entity.ark:
-            name = self.entity.ark.replace("/", "_")
+            name = self.entity.ark.replace("/", "-")
             return u'EAC_{0}.xml'.format(name)
         return super(AuthorityRecordEACAdapter, self).file_name
 
     def recordid_element(self, control_elt):
         # export ark in <recordId>
diff --git a/test/test_views.py b/test/test_views.py
--- a/test/test_views.py
+++ b/test/test_views.py
@@ -176,11 +176,11 @@ class FuncViewsTC(CubicWebTC):
         with self.admin_access.web_request() as req:
             cnx = req.cnx
             agent = testutils.authority_record(cnx, u'jim')
             for ark, expected_filename in (
                 (u"", "EAC_{0}.xml".format(agent.eid)),
-                (u"ZZZ/4242", "EAC_ZZZ_4242.xml".format(agent.eid)),
+                (u"ZZZ/4242", "EAC_ZZZ-4242.xml".format(agent.eid)),
             ):
                 agent.cw_set(ark=ark)
                 view = self.vreg['views'].select('eac.export', req, agent.as_rset())
                 view.set_request_content_type()
                 self.assertEqual(


More information about the saem-devel mailing list