[Zope-dev] Intercepting __getattr__ in a Python 2.3 old-style mixin class?
lists at zopyx.com
Mon Nov 7 13:01:55 CET 2016
I have a large Python 2.3 based installation with 200k LOC. As part of a migration project I need to intercept all attribute lookups of all old-style class.
Old legacy code:
My idea is to inject a common mixin class like
class Foo(Bar, Mixin):
def __getattr__(self, k)
print repr(self), k
return Foo.__getattr__(self, k)
However I am running always into a recursion because Foo.__getattr__ resolves to Mixin.__getattr__.
(The migrated code has to run under Python 2.3 as the first step of the migration where will be moving
forward to Python 2.7 later on).
Is there any way to fix the code for Python 2.3 old-style classes?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 618 bytes
Desc: OpenPGP digital signature
More information about the Zope-Dev