summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-06-29 14:59:01 (GMT)
committerFred Drake <fdrake@acm.org>2001-06-29 14:59:01 (GMT)
commit9f9bd6af7805d1df5152318663a55f0087b51eac (patch)
treeaab9e054e4cce547aea84b24ffa3bf82a61f8cfe
parent52b8c29ca7172b4a6821e3e34b293562f3ae9a3f (diff)
downloadcpython-9f9bd6af7805d1df5152318663a55f0087b51eac.zip
cpython-9f9bd6af7805d1df5152318663a55f0087b51eac.tar.gz
cpython-9f9bd6af7805d1df5152318663a55f0087b51eac.tar.bz2
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.
-rw-r--r--Doc/lib/libcgi.tex5
1 files changed, 1 insertions, 4 deletions
diff --git a/Doc/lib/libcgi.tex b/Doc/lib/libcgi.tex
index 285c08f..8ab562d 100644
--- a/Doc/lib/libcgi.tex
+++ b/Doc/lib/libcgi.tex
@@ -89,10 +89,7 @@ non-empty string:
\begin{verbatim}
form = cgi.FieldStorage()
-form_ok = 0
-if form.has_key("name") and form.has_key("addr"):
- form_ok = 1
-if not form_ok:
+if not (form.has_key("name") and form.has_key("addr")):
print "<H1>Error</H1>"
print "Please fill in the name and addr fields."
return