[Zope] Feedback: The namespace howto

Michel Pelletier michel@digicool.com
Wed, 1 Sep 1999 15:23:06 -0400


> -----Original Message-----
> From: Rik Hoekstra [mailto:hoekstra@fsw.leidenuniv.nl] 
> Sent: Tuesday, August 31, 1999 4:07 PM
> To: info@digicool.com
> Subject: Feedback: The namespace howto
> 
> 
> Once again clearly explained, except for the most zennish of features.
> Let me once again ventilate my frustrations:
> 
> - Acquisition works mostly as expected - (though not always with DTML
> Methods/Documents, see my other feedback)
> - It has always excaped me how acquisition works with folders that are
> on a same level? For example:
> 
>             ROOT 
>               | index_html
>               |
>    ----------------------
>    |                    |
> OneFolder           SecondFolder
>    |                      index_html
> Subfolder
> 
> 
> You can call this in various ways (for instance if 
> Secondfolder holds a
> different sitedesign, and OneFolder holds the data; or with
> multilanguage versions of a site):
> 
> URL1 http://mysite/OneFolder/Subfolder/SecondFolder
> 
> URL2 http://mysite/SecondFolder/OneFolder/Subfolder
> 
> The riddle: in both cases which index_html is to be returned - I
> struggled with this so much I can't remember which did what and why. I
> can tell it was _not_ intuitive at all... The only way I found
> 

In both cases, /SecondFolder/index_html is returned.

In the first URL, second folder returns it's index_html directly.  At
that point, the *acquisition* name space stack is:

Secondfolder
Subfolder
Onefolder
ROOT

During traversal, Onefolder finds subfolder, which then does not find
secondfolder, so it searches back through the path until it finds
'secondfolder', which then returns it's index_html.

In the second URL, SubFolder has no 'index_html' method, so it tries to
acquire it.  it will search the namespace stack from the top down:

SubFolder
OneFolder
SecondFolder
ROOT

thus finding the first 'index_html' in secondfolder.

The reason why you can acquire in this way is because the root folder is
*allways* the bottom item on the acquisition name space.  By that logic,
that means that *all items in the root folder are acquirable by the
whole object heirarchy*.

> Hm, I suppose this was also a request for enlightenment, not just
> feedback - oh well

Were you enlightened?

-Michel

>  
> Rik Hoekstra
>