[Zope-dev] Removing the acquisition wrapper from an object (Python script)

Leonardo Rochael Almeida leo@hiper.com.br
01 Aug 2002 18:37:29 -0300


On Thu, 2002-08-01 at 14:38, Gilles Lenfant wrote:
> [...]
> Now I'm always looking for an alternate way to get rid of the acquisition wrapper and access only the objects own props.

To access an object's own props (and get an error if it doesn't find
them instead of looking up the aq-chain) you don't need to remove it's
acquisition wrappers, you just need to tell him not to use acquisition
implicitly. The way you do that is to ask the object for a
non-implicit-acquisition version of itself, that is, an explicit
acquisition object:

non_implicit_obj = obj.aq_explicit

obj.some_attr

or just:

obj.aq_explicit.some_attr

for short.

This way, 'some_attr' won't be looked up in the object's acquisition
chain

	Cheers, Leo

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.