I perhaps should have clarified that I need to be able to specify the
name of the attributes or methods at run time, so ComputedAttribute
unfortunately won't do the trick as you have to define each
attribute/method you require in the class definition.
ie. I need something like :
def
Casey Duncan wrote:
__getattr__ hooks are evil, only to be used as a last resort. Are you So I've found,
and heard! It didn't stop me from tyring, and I still don't see why they should be
so hard so work with, difficult perhaps, but I wouldn't have though you needed to
pull the seemingly
There is no default or normal __getattr__. __getattr__ is defined only
when you need abnormal ways of getting an attribute.
Do you mean it only gets defined when standard (instance class based)
searching methods fail?
If I try a similar thing to this, I always end up getting the 'old' one
From: John Barratt [EMAIL PROTECTED]
Do you mean it only gets [called] when standard (instance class based)
searching methods fail?
Yes. At least, this is what the documentation sais, and it seems to be true
as far as I can see.
Object Manager doesn't specifically, but Implicit does, you can
Erik A. Dahl wrote:
Ok I need to override __getattr__ in one of my product classes. I'm
sure this is killing acquisition
yes
but not sure about the persistence
stuff (I think this is working).
it will still work
Is there a way to make this work?
yes
Here is what I'm doing:
If your __getattr__ fails to find what it wants, it should raise an
AttributeError. This will give the ball back to the acquisition
machinery.
Thusly:
def __getattr__(self, name):
if name = 'foo':
return self.foo()
raise AttributeError, name
hth,
-Casey
On Tue, 2002-06-04 at
How about making __setattr__ work ? I keep having Acquisition tell me that it
cannot find the Acquisition.Acquired properties.
Nic
On Wednesday 05 June 2002 09:21 am, Casey Duncan wrote:
If your __getattr__ fails to find what it wants, it should raise an
AttributeError. This will give the