[Zope] Messing with the namespaces stack [Was: (no subject)]
Jeff K. Hoffman
jeff.hoffman@goingv.com
Fri, 30 Jun 2000 16:01:33 -0400 (EDT)
On Fri, 30 Jun 2000, Shane Hathaway wrote:
> Also remember you can play tricks with acquisition. If you have a
> "default" style and a "lowres" style, you can set up your directories
> like this:
>
> /home
> /lowres
> /content
>
> "lowres" and "content" are both children of "home". The default style
> elements are in home. When the user browses to
> /home/content/index_html, they get the default style. When the user
> visits /home/lowres/content/index_html, they get the lowres style.
This is, actually, not quite right.
Given the following hierarchy:
/home
header
footer
/content
index_html
/lowres
header
footer
and a request of /home/content/index_html, we have the following
acquisition path (assuming index_html is a DTML Method):
/home/content = (content of home)
/home/content/index_html = (index_html of (content of home))
Assuming index_html contains:
<dtml-var header>
Content.
<dtml-var footer>
when index_html asks for header, the acquisition path is searched
from left to right; the content folder is searched first, followed by the
home folder, where header is found.
Now, with a request of /home/lowres/content/index_html, we have:
/home/lowres = (lowres of home)
/home/lowres/content = ((content of home)
of (lowres of home))
/home/lowres/content/index_html = (index_html of ((content of home)
of (lowres of home)))
Therefore, when index_html looks for header, the content folder is
searched, then the home folder, then the lowres folder, then the home
folder. Unfortunately, for our example, the header is found in the search
of the home folder, and we never make it to the lowres folder.
If, instead, we structure the request as /home/content/lowres/index_html,
we have:
/home/content = (content of home)
/home/content/lowres = ((lowres of home)
of (content of home))
/home/content/lowres/index_html = (index_html of ((lowres of home)
of (content of home)))
When index_html looks for header, we search lowres, then home, then
content, then home. The header is picked up from lowres, which is what we
want.
Hope this makes sense. Acquisition is not one of the things I have become
good at explaining, yet. The slides from Jim's Acquisition Algebra talk is
about the best source of information on this subject.
> Shane
--Jeff
---
Jeff K. Hoffman 704.849.0731 x108
Chief Technology Officer mailto:jeff.hoffman@goingv.com
Going Virtual, L.L.C. http://www.goingv.com/