[Zope] strange path "feature"

Bruce Elrick belrick@home.com
Wed, 10 Nov 1999 14:04:47 -0700


Sachin Shah wrote:
> 
> ok so I am quite new to Zope, and I am wondering if this is a feature
> or a bug (using the zope site as an example):
> 
> http://www.zope.org/Documentation
> 
> results in the Documents page
> 
> http://www.zope.org/Resources
> 
> results in the resources page, BUT so does:
> 
> http://www.zope.org/Documentation/Resources
> 
> Whether it is a feature or a bug, how can I stop it from doing that?
> 
> (PS. If it is a feature, I would appreciate any sort of explanation as to
> what is happening to make this occur.)

Ahh...the wonders of acquisition.  The URL
http://www.zope.org/Documentation/Resources has Zope first look in the
Documentation folder for an object called Resources.  When it doesn't find
one, it goes up the 'namespace stack', which typically is the list of folders
in the path in the URL.  In this case, the parent to Documentation, the root
folder, is searched next, where it does find an object called Resources.  The
power of this is that Resources, accessed from either location, _can_ behave
differently because it has a different _context_.  

How do you prevent it?  Well, you can't, but you can design your site so that
you don't create links that take you to unwanted URLs like the above.  For
example, on the Zope site, the side bar has a relative link to "Resources". 
They don't worry about that because acquisition makes it possible.  However,
they could have the sidebar link to "/Resources", then it always goes to 
Resources from the root.

I hope this clears thinks up a bit.  Actually, it won't because acquisition
still confuses a lot of us. :-)

Cheers...
Bruce
--
Bruce Elrick, Ph.D.                       Saltus Technology Consulting Group
Personal: belrick@home.com                          IBM Certified Specialist
Business: belrick@saltus.ab.ca          ADSM, AIX Support, RS/6000 SP, HACMP