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:
class Foo(Bar):
...
My idea is to inject a common mixin class like
class Foo(Bar, Mixin):
...
class 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?
-aj
Old legacy code:
class Foo(Bar):
...
My idea is to inject a common mixin class like
class Foo(Bar, Mixin):
...
class 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?
-aj