[Zope-dev] __setattr__ and acquisition ( was RE: __getattr__
and acquisition)
Erik A. Dahl
edahl@confmon.com
Wed, 05 Jun 2002 15:24:56 -0400
Yep. This is a problem for me I'm trying to find something through
acquisition in my __setattr__. Self is totally unwrapped. Can anyone
think of a creative solution? aq_acquire doesn't help because self is
not a wrapped object. :( Can't pass in the object I want because the
whole point of the setattr is to get around the function call.
-EAD
Shane Hathaway wrote:
> Nicholas Henke (by way of Nicholas Henke ) wrote:
>
>> Given the following code:
>> I can see why access to self.thing fails in Inner::__setattr__, but
>> the question is how do I do that -- can I not use __setattr__ and
>> have to use a setAttr that is accessed via O.I.setAttr('help','me
>> rhonda') ?
>
>
> Acquisition uses a subtle trick that makes everything work: the "self"
> passed to most methods is actually an acquisition wrapper, rather than
> the object itself. But the "self" passed to certain methods like
> __setattr__() is not wrapped. I'm sure there's a good reason.
>
> HTH.
>
> Shane
>
>
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope )