[Zope] Re: Two newbie questions

Evan Simpson evan@4-am.com
Wed, 08 Sep 1999 09:26:53 -0500


Chris Fassnacht wrote:

> First, let me thank both of you for very helpful answers to my questions.
> I've got the looping through the lines property to generate links working
> pretty well.  And I think I'm getting a better understanding of acquisition.

Glad to be of service.

> But I still have one problem, and a comment.
>

[Essentially: Why doesn't acquisition scan the whole database?]

Did you realize that this is what your questions boil down to? <wink>  Do you
really want to wake up every object in the ODB if you make a typo in a property
name?  Be sure to specify what order objects are searched; this is important!

Seriously, one of the most powerful aspects of acquisition is the way it lets
you control the search context and ordering.  You decide which objects should
be included and which are irrelevant, and what overrides what.

It's not clear whether you understand the distinction between the containment
hierarchy and the acquisition context.  The normal structure of the ZODB, with
nested folders containing methods and objects, is a familiar organizational
convenience.  Object IDs are unique *within their container*, but not
globally.  The hierarchy also provides a *default* acquisition context for each
object, since the bare minimum context for an object is the straight line
defined by its absolute URL -- the list of containing objects.

Acquisition context can be much more convoluted than simple containment,
however.  At *each step* in the resolution of a URL, an object can be acquired
from *any previous object* in the URL.  This means that given "A/B/C/D", "A"
must be in the root, "B" must be in "A" *or the root*, "C" must be in "A", "B",
or the root, etc.  Essentially, a URL builds an "environment" (I prefer
'context') step-by-step.  You can leap around in the current environment with
each new step, and then the target object or method is rendered in this
environment.

The canonical example of this is the standard_html_* objects.  The root always
contains default values for these, which can be overridden by including a
folder in your URL which contains objects of the same name.  You can thus
refine your requirements by inserting objects into the URL.  One could, for
instance, have a URL like "/styles/fancy/framed/extras/js/flash/docs/MyDoc"
which accesses the same object as "/docs/MyDoc", but tells it to render using
fancy, framed HTML with JScript and Flash animations.

> I think Zope is a marvelous programming environment, and I think it
> represents a much bigger shift in the web development paradigm than it seems
> at first glance.  Regardless of my complaints about acquisition, I'll be
> sticking with it.

True enough, and good for you!