cgi.py and HTML 4.0 compliancy
Michael Ströder
michael at stroeder.com
Tue Feb 6 10:44:06 EST 2001
Juergen wrote:
>
> according to "validator.w3.org" the following URL is not HTML 4
> compliant:
> <a href="mycgiscript.py?firstParam=Bill&secondParam=Whitters">Some
> Text</a>
Maybe HTML4 mandates to use a form.
<form>
<input type="hidden" name="firstParam" value="Bill">
<input type="hidden" name="secondParam" value="Whitters">
<input type="submit" value="Some Text">
</form>
> I think the correct form of the above URL would be:
> <a href="mycgiscript.py?firstParam=Bill%26secondParam=Whitters">Some
> Text</a>
> but I am not sure. At least the validator doesn't complain anymore.
Well, this is not the same as the URL above.
> The problem with this URL is, that the cgi modules FieldStorage class
> can't handle this format properly.
Yes, off course. You URL-quoted the ampersand ('&') which is
necessary to separate the input fields.
> As a workaround I modified cgi.parse_qsl by adding a new line:
Don't do that. It violates the standard and works only if your
parameter values does not contain an ampersand.
> I wonder if some Python core developer should take care of this or if
> the HTML validator needs to be fixed.
Both are ok. IMHO your HTML has to be fixed.
Ciao, Michael.
More information about the Python-list
mailing list