[hook] fix hook base class so access to __registries__ doesn't call check_event, only call it in registered callback. Closes #2517748 stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 14 Nov 2012 11:12:13 +0100
branchstable
changeset 8588 22af622e6e24
parent 8587 bde0501e0251
child 8589 ee9ecfccc3e8
[hook] fix hook base class so access to __registries__ doesn't call check_event, only call it in registered callback. Closes #2517748
server/hook.py
--- a/server/hook.py	Thu Nov 08 11:43:11 2012 +0100
+++ b/server/hook.py	Wed Nov 14 11:12:13 2012 +0100
@@ -557,9 +557,14 @@
             raise Exception('bad .events attribute %s on %s.%s' % (
                 cls.events, cls.__module__, cls.__name__))
 
+    @classmethod
+    def __registered__(cls, reg):
+        cls.check_events()
+
     @classproperty
     def __registries__(cls):
-        cls.check_events()
+        if cls.events is None:
+            return []
         return ['%s_hooks' % ev for ev in cls.events]
 
     known_args = set(('entity', 'rtype', 'eidfrom', 'eidto', 'repo', 'timestamp'))