Avoid using gone hooks_control() in migration
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 30 Jul 2019 14:47:25 +0200
changeset 12715 d59570643a49
parent 12714 27ea20b1915f
child 12716 f5300acd8f4f
Avoid using gone hooks_control() in migration This deprecated function got dropped in a8c1ea390400. Remove unused import in 3.10.9_Any.py migration; replace usage in bootstrapmigration_repository.py by non-deprecated form.
cubicweb/misc/migration/3.10.9_Any.py
cubicweb/misc/migration/bootstrapmigration_repository.py
--- a/cubicweb/misc/migration/3.10.9_Any.py	Tue Jul 30 14:42:15 2019 +0200
+++ b/cubicweb/misc/migration/3.10.9_Any.py	Tue Jul 30 14:47:25 2019 +0200
@@ -7,7 +7,6 @@
 
 if confirm('fix existing cwuri?'):
     from logilab.common.shellutils import progress
-    from cubicweb.server.session import hooks_control
     rset = rql('Any X, XC WHERE X cwuri XC, X cwuri ~= "%/eid/%"')
     title = "%i entities to fix" % len(rset)
     nbops = rset.rowcount
--- a/cubicweb/misc/migration/bootstrapmigration_repository.py	Tue Jul 30 14:42:15 2019 +0200
+++ b/cubicweb/misc/migration/bootstrapmigration_repository.py	Tue Jul 30 14:47:25 2019 +0200
@@ -20,7 +20,6 @@
 it should only include low level schema changes
 """
 from cubicweb import ConfigurationError
-from cubicweb.server.session import hooks_control
 from cubicweb.server import schemaserial as ss
 
 applcubicwebversion, cubicwebversion = versions_map['cubicweb']
@@ -261,7 +260,7 @@
     session.set_cnxset()
     permsdict = ss.deserialize_ertype_permissions(session)
 
-    with hooks_control(session, session.HOOKS_ALLOW_ALL, 'integrity'):
+    with session.allow_all_hooks_but('integrity'):
         for rschema in repo.schema.relations():
             rpermsdict = permsdict.get(rschema.eid, {})
             for rdef in rschema.rdefs.values():