On Thu, Feb 27, 2003 at 11:14:59AM +0000, Marc Burgauer wrote:
Hi
I have a problem creating valid HTML 4 with Zope. It seems that Zope inserts a <base> tag when calling an index_html document without specifying the file:
<base href="http://127.0.0.1:8080/" />
yes, this is necessary or else relative URLs will not work. if you view http://foo:8080/bar/, without the base tag, the browser will treat a link in bar/index_html e.g. <a href="baz"> as http://foo:8080/baz instead of the intended http://foo:8080/bar/baz.
If I type in my browser "http://127.0.0.1:8080/" Zope adds the base tag. If I type "http://127.0.0.1:8080/index_html", it doesn't. Sadly the way it creates this tag is not valid HTML 4.01 strict (or transitional) according to validator.w3.org. We want to use W3's icons on the sites we're building, as it seems the closest thing to a certificate for quality-HTML. (Basically it something that helps selling.)
The offending thing is the XML-like ending. " />" If I remove the space-slash from the code, it validates.
I assume that I could suppress this somewhere in the source code (possibly HTTPResponse.py), but I'm not sure where and how.
You're correct - ZPublisher/HTTPResponse.py, the method is insertBase and the offending slash is added around line 313 as of zope 2.5.1. you'll have to either patch the source or use a "monkey patch." http://www.zope.org/Members/Caseman/Dynamic_Hotfix -- Paul Winkler http://www.slinkp.com