Exploring Zope

goran.krampe at bluefish.se goran.krampe at bluefish.se
Thu Oct 30 10:04:44 UTC 2003


John Maxwell <jmax at sfu.ca> wrote:
> ducasse wrote:
> 
> > could you tell us a word or more ;) on acquisition?
> 
> Thanks Eric for the detail...
> 
> The real short answer is: out of the box, Zope gives you two kinds of 
> inheritance. The first is regular class inheritance; the second is 
> acquisition, which, in the webserver metaphor means that if I have an 
> object (an image, for instance) available in the namespace at the top 
> of the hierarchy, I can refer to it "locally" six folders down. This is 
> incredibly handy for web work, because, for instance, you can build a 
> single navigation system at the top level and simply refer to it all 
> the way down the tree. Zope's built-in security/access model lends 
> itself really nicely to this, too.
> 
>   - John Maxwell
>     jmax at sfu.ca

I haven't followed this thread more than "casually" but it just occurred
to me that HttpView has a similar mechanism. When a request is processed
by the HttpView framework a chain of HVHttpView subclasses are chained
together with parent pointers. Each view typically maps to a "directory"
in the url.

So eventually, when HTML is to be produced you are sitting in a method
in a view class and you have both the class inheritance (there are
utility methods in the base HVHttpView class and you often have your
application specific base subclass too) and the "self parent blabla"
mechanism.

Anyway, it isn't "hardwired" that much, but that is at least similar.
For example this means that each directory in the urls match a method in
a view class - for example in method #account I typically check that you
are logged in and get your session. And that is the only place I do that
and thus this protects all urls beginning with "/account/...".

Well, just an observation.

regards, Göran



More information about the Squeak-dev mailing list