Commit 9f9bd6af authored by Fred Drake's avatar Fred Drake

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.
parent 52b8c29c
...@@ -89,10 +89,7 @@ non-empty string: ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment