unregister hooks by using category
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 23 Sep 2009 12:23:14 +0200
changeset 3417 fb17a54b358c
parent 3416 d74c627981e1
child 3423 d1356e008b19
unregister hooks by using category
server/checkintegrity.py
--- a/server/checkintegrity.py	Wed Sep 23 12:23:00 2009 +0200
+++ b/server/checkintegrity.py	Wed Sep 23 12:23:14 2009 +0200
@@ -68,8 +68,6 @@
     """reindex all entities in the repository"""
     # deactivate modification_date hook since we don't want them
     # to be updated due to the reindexation
-    from cubicweb.server.hooks import (setmtime_before_update_entity,
-                                       uniquecstrcheck_before_modification)
     from cubicweb.server.repository import FTIndexEntityOp
     repo = session.repo
     cursor = session.pool['system']
@@ -80,10 +78,8 @@
         # XXX indexer.init_fti(cursor) once index 0.7 is out
         indexer.init_extensions(cursor)
         cursor.execute(indexer.sql_init_fti())
-    repo.hm.unregister_hook(setmtime_before_update_entity,
-                            'before_update_entity', '')
-    repo.hm.unregister_hook(uniquecstrcheck_before_modification,
-                            'before_update_entity', '')
+    repo.config.disabled_hooks_categories.add('metadata')
+    repo.config.disabled_hooks_categories.add('integrity')
     repo.do_fti = True  # ensure full-text indexation is activated
     etypes = set()
     for eschema in schema.entities():