Fix deferred injection to inject methods that actually do respect subclass overrides
authorClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Wed, 29 Jun 2011 09:04:29 +0000 (11:04 +0200)
committerClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Wed, 29 Jun 2011 09:04:29 +0000 (11:04 +0200)
src/nepi/util/proxy.py

index 9dcb5c9..bdf4b4c 100644 (file)
@@ -967,8 +967,10 @@ class BaseProxy(object):
                     
                     # inject _deferred into core classes
                     if hasattr(template_class, methname) and not hasattr(template_class, dmethname):
-                        setattr(template_class, dmethname, 
-                            getattr(template_class, methname))
+                        def dmeth(self, *p, **kw): 
+                            return getattr(self, methname)(*p, **kw)
+                        dmeth.__name__ = dmethname
+                        setattr(template_class, dmethname, dmeth)
         
         return rv