Re: [Orbit-python-list] orbit-python and __setattr__ overloading
Status: Inactive
Brought to you by:
tack
|
From: Jason T. <ta...@li...> - 2001-01-30 19:27:40
|
> Hi,
Hi Marcelo,
> is it possible that orbit-python would set the attribites through
> __setattr__ the way I though so could overload it ?
Keep in mind that ORBit-Python's transparent handling of attributes is
not really part of the mapping spec, and there are some good reasons to
avoid using them (such as explicitness). I personally like the idea of
transparency, though.
At the moment, ORBit-Python won't call the servant's __setattr__ and
__getattr__ functions on invocation of one of the attribute accessor
functions. It obviously should. I expect that's an easy thing to fix,
so I'll do that right now. (Stay tuned.)
As an alternative, you could override the accessor function, which is
what you're supposed to do anyway (if you want to be compliant with the
mapping spec). So for example:
interface Foo {
attribute string mystr;
};
Then in the implementation:
class Foo_Impl(Global__POA.Foo):
def _set_mystr(self, val):
print "Setting mystr attribute"
self.mystr = val
def _get_mystr(self):
print "Getting mystr attribute"
return self.mystr
Anyway, I'll commit a fix for ORBit-Python to call __setattr__ and
__getattr__ for the servant in the absence of an implemented accessor
function.
Cheers,
Jason.
|