hooks have been refactored, call [re|de]activate_verification_hooks
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 18 Aug 2009 00:23:15 +0200
changeset 2892 7ae3d62a8328
parent 2891 60afb9705035
child 2893 5989ce0707bc
hooks have been refactored, call [re|de]activate_verification_hooks
misc/migration/bootstrapmigration_repository.py
--- a/misc/migration/bootstrapmigration_repository.py	Tue Aug 18 00:22:10 2009 +0200
+++ b/misc/migration/bootstrapmigration_repository.py	Tue Aug 18 00:23:15 2009 +0200
@@ -11,11 +11,9 @@
 applcubicwebversion, cubicwebversion = versions_map['cubicweb']
 
 if applcubicwebversion < (3, 4, 0) and cubicwebversion >= (3, 4, 0):
-    from cubicweb import RepositoryError
-    from cubicweb.server.hooks import uniquecstrcheck_before_modification
+
     session.set_shared_data('do-not-insert-cwuri', True)
-    repo.hm.unregister_hook(uniquecstrcheck_before_modification, 'before_add_entity', '')
-    repo.hm.unregister_hook(uniquecstrcheck_before_modification, 'before_update_entity', '')
+    deactivate_verification_hooks()
     add_relation_type('cwuri')
     base_url = session.base_url()
     # use an internal session since some entity might forbid modifications to admin
@@ -26,8 +24,7 @@
             isession.execute('SET X cwuri %(u)s WHERE X eid %(x)s',
                              {'x': eid, 'u': base_url + u'eid/%s' % eid})
     isession.commit()
-    repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_add_entity', '')
-    repo.hm.register_hook(uniquecstrcheck_before_modification, 'before_update_entity', '')
+    reactivate_verification_hooks()
     session.set_shared_data('do-not-insert-cwuri', False)
 
 if applcubicwebversion < (3, 2, 2) and cubicwebversion >= (3, 2, 1):