[Zope-CMF] How to get Type in manage_afterAdd?

Jon Edwards jon@pcgs.freeserve.co.uk
Sat, 2 Feb 2002 14:10:58 -0000


Thanks Dieter, that helped a lot (both in this context, and to increase my
general understanding!) :-)

I'll use aq_base in this case.

I had google-searched a lot, but sometimes you have to hear the same point
explained in different ways before it sinks in! ...and sometimes you find
information, but you're not sure how up-to-date it is.

Evan's "Untangling Acquisition with Trees"
(http://www.zope.org/Members/4am/aq_trees) is a great help, but doesn't
mention aq_explicit. My understanding is that aq_explicit limits the search
to the left sub-tree of the diagrams?

Cheers, Jon

> -----Original Message-----
> From: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]On Behalf
> Of Dieter Maurer
> Sent: 02 February 2002 10:56

> When you have an aquisition wrapped object, it has two components,
> "aq_self" and "aq_parent". When you ask the object for an attribute,
> it asks "aq_self" for it. If this fails, then it depends whether
> or not the object is an explicit or an implicit acquisition wrapper
> (in the current Zope, most objects are implicitly wrapped).
> For an implicit wrapper, "aq_parent" is automatically asked
> for the attribute.
>
>  > Could anyone give an example where aq_explicit might not do
> what I want in
>  > this context (I'm checking to see if a folder already has an
> 'index.htm'
>  > document before adding it)?
> It is not so easy to construct an example that fails in your context
> (it may be impossible). The problem may show up, when
> you access your folder in a way where acquisition is used several
> times, say you have:
>
>        folder/
>          your_special_folder
> 	 some_other_folder
>
> 	 your_document
>
> and in "your_document" you access "some_other_folder.your_special_folder",
> then what you get is an acquisition wrapped object whose
> "aq_self" is again acquisition wrapped. This second level acquisition is
> not disabled by use of "aq_explicit".