[Zope] From whence came <base>?

Dieter Maurer dieter@handshake.de
Fri, 19 Jul 2002 21:24:40 +0200


Charlie Reiman writes:
 > I have a simple site with two pages
 > 
 > /corp/index_html
 > /corp/sub/index_html
 > 
 > Both are DTML documents.
 > Both have identical html headers (as far as my eyes can tell).
 > The sub/index_html takex GET arguments, the other does not:
 > 
 > /corp/sub/index_html?blah=yep&foo=nope
 > 
 > The rendered source for /corp/index_html as seen from the browser has a
 > <BASE> tag I never requested (but really want!)
Strange. I would not expect it.

   The base tag is not necessary in this case.

 > The rendered source for /corp/sub/index_html does not have a <base> tag.
It does not need either.

 > This second fact is upsetting.
Why do you want one?

 > I'd really like to get a <base> tag in there.
 > Aside from manually inserting it, how can I get zope to do whatever magic it
 > did on the first page?
Zope sets the base tag automatically whenever it effectively modifies the
URL. It is e.g. the case, when it automatically appends "index_html"
or when a ":method" form variable takes effect.

The base tag is necessary in these cases to tell the browser the new
URL such that it has a chance to resolve relative URLs correctly.

When Zope does not tweak the URLs there is no need for a base tag.
If you want one anyway, you need to provide your own
base tag (or look at "ZPublisher.BaseRequest.BaseRequest.traverse";
the variable that controls the base tag generation is
called something link "_hacked_path").


Dieter