[Zope-dev] Acquisition ( slightly less Confusion ;-)

Chris Withers chrisw@nipltd.com
Thu, 17 Aug 2000 14:29:15 +0100


Evan Simpson wrote:
> > > - never expose a "bare" object, or even one with an incomplete context
> >
> > Why? You can get at it through aq_base anyway, surely?
> 
> Only from unrestricted code.  DTML and (CVS) Python Methods only let you
> access aq_parent.  This only applies to objects that are part of the
> containment hierachy, of course.  Brand new objects aren't wrapped, nor are
> simple non-persistent types like lists and dicts.

Ah, okay... so really, prettymuch all Zope objects should be wrapped
with only one or two exceptions, most of which aren't actually objects
as such but simple data types?


> > Would it matter if the
> > wrappers were structured differently to provide a different search
> > order?

> Only to anyone who depends on the current behavior :-) 

Heh, ain't backward compatability a bitch ;-)

> Also, there is a
> very limited range of "natural" ways to construct the wrappers.  Once
> contructed, of course, we can fool with them in arbitrary ways.

So I see, does this reduce efficiency at all?

> We want to be able to find out what an object's container is, regardless of
> what we acquired it from.  In raw acquisition, there's no straightforward
> way to do this.  In simplified acquisition, aq_inner.aq_parent is the
> container.  The simplification is the rule (A o B) o (B o C) => A o (B o C).

I don't see how this simplification actually makes a difference...
In what way does it change the search order?
From what I read, I though it just reduced the number of checks you had
to do...

> All of these would search the dotted expression from right to left, so they
> would give you B's I.
> > <dtml-var expr="aq_context(A.B.C.D).I">
> > <dtml-var expr="aq_context(A.B.C).I">
> > <dtml-var expr="aq_context(A.B).I">

cool :-)

> All of these would search the containers of the right-most object, so the
> first two would give you A's I, and the third B's I.
> > <dtml-var expr="aq_containment(A.B.C.D).I">
> > <dtml-var expr="aq_containment(A.B.C).I">
> > <dtml-var expr="aq_containment(A.B).I">

weird ;-S (but I suppose someone might find it useful ;-)

The external methods were very cool. How should I got about petitioning
for 
<dtml-var anobject aq_context> to become valid syntax?

cheers,

Chris