# HG changeset patch # User Julien Jehannet # Date 1295604820 -3600 # Node ID 23554151486c1cd8257178efc1644b291dd9af8f # Parent b746dae3a0047c6ea78e75e221893bec43c88d52 [vreg] check for identical app objects when replacing Prevent from weird behaviour when you badly wrote vreg callback diff -r b746dae3a004 -r 23554151486c 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: