when debugging explain why objects are kicked out of registry
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Tue, 21 Apr 2009 22:28:15 -0500
changeset 1592 80e0ef472ec3
parent 1591 e85bf08a123b
child 1593 8602116daef3
when debugging explain why objects are kicked out of registry
common/registerers.py
vregistry.py
--- a/common/registerers.py	Tue Apr 21 22:23:28 2009 -0500
+++ b/common/registerers.py	Tue Apr 21 22:28:15 2009 -0500
@@ -36,13 +36,13 @@
                 self.warning('priority_registerer found more than one registered objects '
                              '(registerer monkey patch ?)')
             for regobj in registered[:]:
-                self.kick(registered, regobj)
+                self.kick(registered, regobj, 'more than one object')
         return self.vobject
     
     def remove_equivalents(self, registered):
         for _obj in registered[:]:
             if self.equivalent(_obj):
-                self.kick(registered, _obj)
+                self.kick(registered, _obj, 'equivalent to %s'%_obj)
                 break
             
     def remove_all_equivalents(self, registered):
@@ -50,7 +50,7 @@
             if _obj is self.vobject:
                 continue
             if self.equivalent(_obj):
-                self.kick(registered, _obj)
+                self.kick(registered, _obj, 'all are equivalent')
 
     def equivalent(self, other):
         raise NotImplementedError(self, self.vobject)
@@ -63,7 +63,7 @@
     """
     def do_it_yourself(self, registered):
         if registered:
-            self.kick(registered, registered[-1])
+            self.kick(registered, registered[-1], 'diy')
         return 
     
 
--- a/vregistry.py	Tue Apr 21 22:23:28 2009 -0500
+++ b/vregistry.py	Tue Apr 21 22:28:15 2009 -0500
@@ -65,8 +65,8 @@
     def do_it_yourself(self, registered):
         raise NotImplementedError(str(self.vobject))
         
-    def kick(self, registered, kicked):
-        self.debug('kicking vobject %s', kicked)
+    def kick(self, registered, kicked, msg='?'):
+        self.debug('kicking vobject %s because %s', kicked, msg)
         registered.remove(kicked)
         self.kicked.add(kicked.classid())