[hooksmanager] hooks should be reseted after vreg reload
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 05 Aug 2009 19:14:07 +0200
changeset 2709 6ee816eb9f25
parent 2708 60d728bdcba5
child 2710 40789c3044f3
[hooksmanager] hooks should be reseted after vreg reload
server/repository.py
--- a/server/repository.py	Wed Aug 05 19:13:35 2009 +0200
+++ b/server/repository.py	Wed Aug 05 19:14:07 2009 +0200
@@ -28,11 +28,11 @@
 from yams import BadSchemaDefinition
 from rql import RQLSyntaxError
 
-from cubicweb import (CW_SOFTWARE_ROOT, UnknownEid, AuthenticationError,
+from cubicweb import (CW_SOFTWARE_ROOT, CW_MIGRATION_MAP, CW_EVENT_MANAGER,
+                      UnknownEid, AuthenticationError, ExecutionError,
                       ETypeNotSupportedBySources, RTypeNotSupportedBySources,
                       BadConnectionId, Unauthorized, ValidationError,
-                      ExecutionError, typed_eid,
-                      CW_MIGRATION_MAP)
+                      typed_eid)
 from cubicweb.cwvreg import CubicWebVRegistry
 from cubicweb.schema import VIRTUAL_RTYPES, CubicWebSchema
 from cubicweb import server
@@ -228,6 +228,7 @@
             # register a task to cleanup expired session
             self.looping_task(self.config['session-time']/3.,
                               self.clean_sessions)
+        CW_EVENT_MANAGER.bind('after-registry-load', self.reset_hooks)
 
     # internals ###############################################################
 
@@ -247,7 +248,10 @@
             # full reload of all appobjects
             self.vreg.reset()
             self.vreg.set_schema(schema)
-        self.hm.set_schema(schema)
+        self.reset_hooks()
+
+    def reset_hooks(self):
+        self.hm.set_schema(self.schema)
         self.hm.register_system_hooks(self.config)
         # instance specific hooks
         if self.config.instance_hooks: