[Zope] base href
Dieter Maurer
dieter at handshake.de
Wed Nov 26 14:33:17 EST 2003
Ian Bicking wrote at 2003-11-25 12:33 -0600:
> I'm having a problem with LocalFS, HTML files, and the <base href> that
> gets added to pages. But I feel, at its source, Zope is just being
> nuts.
>
> HTTPResponse.insertBase inserts <base href> to pages; in turn, this
> base is set in HTTPResponse.setBase, where it ensures that the base
> always ends in "/". This causes paths to grow, as leaf pages
> (non-directory pages) get treated like directories. This is annoying
> in normal Zope objects, but LocalFS objects don't seem to acquire
> parents, so the extra elements in the URL that point to a LocalFS are
> just broken.
Many people do not like the Zope generated "base" tags.
But, in fact, they are necessary in order for relative URL
references to work. Zope *MUST* set the base tag whenever
it implicitly modifies the URL. Otherwise, the base URL
assumed by the browser is different from the real base URL
of the request -- relative URL references will fail.
The problem is not Zope's "base" tag. The problem are
non-trivial relative URL references (an relative URL reference
containing at most one "/" -- you must count implicit
addition of "/index_html" done by Zope as well).
To avoid incresing URLs you must avoid non-trivial URL references,
either by strictly using absolute URLs or by using sufficiently
many "../" in your relative URL references.
--
Dieter
More information about the Zope
mailing list