[PATCH saem] [assign ark ws] Fix ARK prefix for organization

Sylvain Thenault sylvain.thenault at logilab.fr
Wed Aug 16 18:25:34 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1502892079 -7200
#      Wed Aug 16 16:01:19 2017 +0200
# Node ID 3b78f9dfd44f0e36f0534eef70596d20d722671e
# Parent  e436241e0bf4efdb76361a590a83f2b9649ad259
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 3b78f9dfd44f
[assign ark ws] Fix ARK prefix for organization

it should be ark:/, not ark://

Closes extranet #32206278

diff --git a/cubicweb_saem_ref/views/ws.py b/cubicweb_saem_ref/views/ws.py
--- a/cubicweb_saem_ref/views/ws.py
+++ b/cubicweb_saem_ref/views/ws.py
@@ -34,11 +34,11 @@ class AssignArkWebService(json.JsonMixIn
     )
 
     # XXX could check Accept=application/json
     def call(self):
         org_ark = self._cw.form['organization']
-        org_ark = org_ark.replace('ark://', '')
+        org_ark = org_ark.replace('ark:/', '')
 
         def error(msg):
             self.wdata([{'error': msg.format(org_ark)}])
 
         try:
diff --git a/test/test_views.py b/test/test_views.py
--- a/test/test_views.py
+++ b/test/test_views.py
@@ -465,11 +465,11 @@ class AssignArkWebServiceTC(CubicWebTC):
                 headers={'Accept': 'application/json'},
                 method='POST', **params) as req:
             result = self.app_handle_request(req, 'ark')
             self.assertEqual(json.loads(result),
                              [{'ark': '0/a000000001'}])
-        params = {'organization': 'ark://' + org_ark}
+        params = {'organization': 'ark:/' + org_ark}
         with self.admin_access.web_request(
                 headers={'Accept': 'application/json'},
                 method='POST', **params) as req:
             result = self.app_handle_request(req, 'ark')
             self.assertEqual(json.loads(result),


More information about the saem-devel mailing list