I'm trying to make a proxy object in IronPython, which should dynamically present underlying structure. The proxy itself shouldn't have any functions and properties, I'm trying to catch all the calls in the runtime. Catching the function calls is easy, I just need to define getattr() function for my object, and check does appropriate function exists in the underlying layer, and return some function-like object.
I have problems with properties - I don't know how to distinguish the calling context, is my property called as a lvalue or rvalue:
o = myproxy.myproperty # *I need to call underlying.myproperty_get()*
or
myproxy.myproperty = o # *I need to call underlying.myproperty_set(o)*
I looked at the list of special functions in Python, but I didn't found anything appropriate.
I also tried to make property in the object on the fly, with combination of exec() and builtin property() function, but I found that IronPython 1.1.2 lacks of entire 'new' module (which is present in IronPython 2.x beta, but I'll rather use IP 1.x, because of .NET 2.0 framework).
Any ideas?