Next / Previous / Contents / TCC Help System / NM Tech homepage

4.9. errorPage

This function creates an HTML page telling the user that the operation failed. The argument is a text string giving details of the failure.

manweb.cgi
# - - -   e r r o r P a g e

def errorPage ( text ):
    """Write an HTML error message page.

      [ text is a string ->
          sys.stdout  +:=  an HTML error message page containing
                           text
          stop execution ]
    """
    #-- 1 --
    # [ sys.stdout  +:=  CGI headers for generating HTML ]
    print "Content-type: text/html"
    print
    print "<html>"
    print "<head>"
    print "  <title>manweb error</title>"
    print "</head>"
    print "<body>"
    print "<h1><tt>manweb</tt> script error</h1>"
    print "<p>We were unable to process your request: %s" % text
    print "</p>"
    print "</body>"
    print "</html>"
    sys.exit(1)