[Tutor] how to return an error from a CGI
Danny Yoo
dyoo at csmail.wpi.edu
Mon May 12 21:49:50 CEST 2008
Hi John,
It's been a long time!
I believe you may be looking for the Status Code stuff that web servers
use to tell browsers that something special is happening. See Section
3.3.1.3 in:
http://www.unix.com.ua/orelly/linux/cgi/ch03_03.htm
for an example done in Perl; the code should be easy to translate to
Python. The idea is to print out a "Status" header at the beginning, so
that the web server knows that it should send out a response with that
particular status code type.
The status codes are also specified as constants in:
http://www.python.org/doc/lib/module-httplib.html
near the bottom of that documentation.
Wikipedia also catalogs the status codes that you can use:
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
More information about the Tutor
mailing list