[vreg] check for identical app objects when replacing stable
authorJulien Jehannet <julien.jehannet@logilab.fr>
Fri, 21 Jan 2011 11:13:40 +0100
branchstable
changeset 6872 23554151486c
parent 6871 b746dae3a004
child 6873 2db631a3f205
[vreg] check for identical app objects when replacing Prevent from weird behaviour when you badly wrote vreg callback
vregistry.py
--- a/vregistry.py	Thu Jan 20 14:38:53 2011 +0100
+++ b/vregistry.py	Fri Jan 21 11:13:40 2011 +0100
@@ -129,6 +129,8 @@
         # or simplify by calling unregister then register here
         if not isinstance(replaced, basestring):
             replaced = classid(replaced)
+        # prevent from misspelling
+        assert obj is not replaced, 'replacing an object by itself: %s' % obj
         registered_objs = self.get(class_regid(obj), ())
         for index, registered in enumerate(registered_objs):
             if classid(registered) == replaced: