[PATCH saem_ref] [migration] Add hack to go through seda 0.8 migration

Sylvain Thenault sylvain.thenault at logilab.fr
Thu Mar 9 10:18:23 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1489006188 -3600
#      Wed Mar 08 21:49:48 2017 +0100
# Node ID 4527676c9f9b22f905150cc6222b9b9c407d7bdf
# Parent  38ce60fdedd73a34567763fbdb57d466277a7735
[migration] Add hack to go through seda 0.8 migration

since it only adds a few schemes, default ark generator reuse already attributed values,
raising database error.

diff --git a/cubicweb_saem_ref/site_cubicweb.py b/cubicweb_saem_ref/site_cubicweb.py
--- a/cubicweb_saem_ref/site_cubicweb.py
+++ b/cubicweb_saem_ref/site_cubicweb.py
@@ -122,10 +122,20 @@ def init_seda_scheme(cnx, title, _count=
     # * NAA for those vocabulary is 25651
     # * generated ark are identical from one instance to another (for scheme and concepts, see
     #   below)
     _count[0] += 1
     ark = u'25651/v%s' % _count[0]
+    if cnx.vreg.config.repairing:  # XXX seda 0.8 migration
+        ark_hack = {
+            u'SEDA 2 : Status légaux': 20,
+            u'SEDA : Règles de diffusion': 21,
+            u"Algorithmes d'empreinte": 22,
+        }
+        try:
+            ark = u'25651/v%s' % ark_hack[title]
+        except KeyError:
+            pass
     scheme = cnx.create_entity('ConceptScheme', title=title, description=description, ark=ark)
     seda.EXTID2EID_CACHE['ark:/' + ark] = scheme.eid
     return scheme
 
 


More information about the saem-devel mailing list