[Zope] Help with Acquisition (long)

Dylan Reinhardt zope@dylanreinhardt.com
07 Jun 2003 09:59:24 -0700


On Sat, 2003-06-07 at 06:29, Greg & Janet LINDSTROM wrote:
> How and Where do I set the member_number so that all of the
> sub-folders can "see" (acquire) it?

The general answer is that some object on the acquisition path needs to
provide the name "member_number".

The acquisition path is determined by performing the following steps in
order:

1. Search the folder immediately containing the called object.
2. Repeat the search for each parent folder, up to the root.
3. Search by context, looking for the required name in every object to
the left of the called object in the request URL, working right to left.

The most transparent way to make this work predictably is to have an
object (script, template, file, etc) called member_number that is at the
highest point in the folder hierarchy over which it is meant to apply. 
E.g.:

/
   A/
      member_number
   B/
      member_number
      C/
      D/

Any request made of any object in B, C, or D will use the value of
member_number acquired from the member_number object in B.  Any child of
A will use A's member_number object.

Another variant is to provide some other kind of object that has a
member_number property/method and ensure that this object is on the
acquisition path.  E.g.:

/
   A/
      info
      method

The "info*" object is able to provide the name "member_number". 
Assuming member_number is required for success, this request will work:

http://server/A/info/method

But this one will not:

http://server/A/method

The first succeeds because it places an object on the acquisition path
that is able to resolve a required name member_number.  In the second
example, neither method nor A nor the root folder provides member_number
and the request will fail.  

It may help to think about the first URL as resolving method *in the
context* of info.

HTH,

Dylan