[Zope] Re: incredible growing urls

Paul Winkler pw_lists@slinkp.com
Thu, 15 May 2003 19:30:36 -0400


On Thu, May 15, 2003 at 03:29:55PM -0700, Dylan Reinhardt wrote:
> On Thu, 2003-05-15 at 10:19, Paul Winkler wrote:
> > On Thu, May 15, 2003 at 09:13:00PM +0200, Dieter Maurer wrote:
> > > When it does not contain complex relative URLs, then the URLs should
> > > not grow.
> > > 
> > > If this is wrong, please post the HTML source.
> > 
> > i'm afraid it is wrong.
> > I already posted a trivial example. 
> 
> Indeed you did.

and it wasn't even the example i meant to give :(
sorry for muddling the issue further.

given two *parallel* folders, A and B (not B within A as I stated),
each containing an index_html;
/A/index_html contains a link
<a href="B"> link to B</a>

/B/index_html contains a link
<a href="A"> link to A</a>

This arrangement will also create the ever-growing URLs.
And it's easy to create this situation by accident. 
Just put the links in a standard_html_header or a 
standard_template and use it in both index_html's.


> Ultimately Dieter's right, though he wasn't being very clear.  

ah, i see. yes, that was not very clear.
by itself, the statement 

>> A trivial URL reference is one not containing a "/". They are harmless.      

... is not really true, as I've shown. 
But the next statement, which qualifies the first, is true: 

>> A relative URL reference containing a "/" is non-trivial 
>> unless the path segment before each "/" is either "." or "..".  

 
> A "trivial" URL *should* contain ../ when it references URLs above the
> current document.
>
> If you don't use that, you're *requesting* the higher
> folder in the context of the lower one... Zope can hardly be blamed for
> giving you what you ask for.

Nice explanation, thanks.
The ../foo idiom works fine with the example I gave above.

> Use ../ for upward-bound URLs and everything should work out fine.
> Or you could always stick to absolute URLs... those are always safe.

And it's easy to get Zope to generate absolute URLs for us.
This has the additional benefit of improving the ability of
browsers* to cache your zope content, as the "../foo"  idiom is not 
guaranteed to always yield the same normalized path once acquisition
comes into play.  This is why i recommend only using absolute URLs
in navigational templates, e.g. the typical standard_html_header
or a CMF main_template.

* probably cacheing proxies like squid too, although i have not
done this myself.

-- 

Paul Winkler
home:  http://www.slinkp.com
"Muppet Labs, where the future is made - today!"