Inconsistency in CGI Documentation????
ignacio at openservices.net
Tue Aug 21 18:57:01 CEST 2001
On Tue, 21 Aug 2001, Maan M. Hamze wrote:
> Ok! I am not going to provide this argument. So, the Text Input element
> that I left empty and had not provided a vlaue for should NOT make it into
> FieldStorage() if user does not type some characters in it. Right? I tried
> it. It does not make it.
> Even if I provide a value of " " (is " " an empty string??)
No. If a string contains even just a single whitespace character it is not
> 2. BUT, read on:
> Of interest is: if form.has_key("firstname") and form["firstname"].value
> != ""
> How come we are checking for the key AND that the vlaue of the key is not
> ""? Is not that code assuming that a non-empty string can be included in
> FieldStorage() without using keep_blank_values? Thus a contradiction with
> what point 1. has to say about it?
It depends on the browser. I'm not certain what the RFCs or W3C has to say
about it, but a browser usually does not send to the server information about
a field that has no value. That doesn't necessarily mean that a browser may
not try to pull that stunt, however :) So the code makes sure that if there IS
a value, that it is not empty.
Ignacio Vazquez-Abrams <ignacio at openservices.net>
More information about the Python-list