[hooks] do not abuse of inheritance for CWRType hooks
authorLaura Médioni <laura.medioni@logilab.fr>
Fri, 27 Jun 2014 12:00:17 +0200
changeset 9960 6359f3121f3f
parent 9959 6047bf8df9e5
child 9961 cef58bd36f7b
[hooks] do not abuse of inheritance for CWRType hooks Just copy the selector to ease readability.
hooks/syncschema.py
--- a/hooks/syncschema.py	Mon Jun 16 10:08:18 2014 +0200
+++ b/hooks/syncschema.py	Fri Jun 27 12:00:17 2014 +0200
@@ -985,7 +985,7 @@
         MemSchemaCWRTypeDel(self._cw, rtype=name)
 
 
-class AfterAddCWRTypeHook(DelCWRTypeHook):
+class AfterAddCWRTypeHook(SyncSchemaHook):
     """after a CWRType entity has been added:
     * register an operation to add the relation type to the instance's
       schema on commit
@@ -993,6 +993,7 @@
     We don't know yet this point if a table is necessary
     """
     __regid__ = 'syncaddcwrtype'
+    __select__ = SyncSchemaHook.__select__ & is_instance('CWRType')
     events = ('after_add_entity',)
 
     def __call__(self):
@@ -1005,9 +1006,10 @@
         MemSchemaCWRTypeAdd(self._cw, rtypedef=rtypedef)
 
 
-class BeforeUpdateCWRTypeHook(DelCWRTypeHook):
+class BeforeUpdateCWRTypeHook(SyncSchemaHook):
     """check name change, handle final"""
     __regid__ = 'syncupdatecwrtype'
+    __select__ = SyncSchemaHook.__select__ & is_instance('CWRType')
     events = ('before_update_entity',)
 
     def __call__(self):