Simplify an example based on comment from Thomas Holenstein <thomas@hex.ch>:
Do not use an extra flag variable to test only once in one subsequent if statement.
This commit is contained in:
parent
52b8c29ca7
commit
9f9bd6af78
|
@ -89,10 +89,7 @@ non-empty string:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
form = cgi.FieldStorage()
|
form = cgi.FieldStorage()
|
||||||
form_ok = 0
|
if not (form.has_key("name") and form.has_key("addr")):
|
||||||
if form.has_key("name") and form.has_key("addr"):
|
|
||||||
form_ok = 1
|
|
||||||
if not form_ok:
|
|
||||||
print "<H1>Error</H1>"
|
print "<H1>Error</H1>"
|
||||||
print "Please fill in the name and addr fields."
|
print "Please fill in the name and addr fields."
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue