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

7.9. deletionPage(): Generate the deletion-successful page

For the HTML generated here, see Section 7, “reader.cgi: An example script with cookies”. This function uses Section 7.10, “genericPage(): Build a generic Web page”, which generates a general-purpose HTML page. See also Section 7.6.19, “PAGE_TITLE.

reader.cgi
# - - -   d e l e t i o n P a g e

def deletionPage():
    '''Write the deletion-successful page.

      [ sys.stdout  +:=  (HTML header) + (blank line) +
                         (deletion-successful page ]      
    '''
    #-- 1 --
    # [ page  :=  a generic HTML page as an et.ElementTree,
    #       with title PAGE_TITLE
    #   body  :=  the body element of that page ]
    page, body  =  genericPage ( PAGE_TITLE )

Next we add the body content.

reader.cgi
    #-- 2 --
    # [ body  +:=  content of the deletion-successful page ]
    div  =  et.SubElement ( body, 'div' )
    div.text  =  'Your records on this server have been erased.'

Finally, write the HTML header, blank line, and page content; see Section 7.6.20, “HTML_HEADER and Section 7.6.18, “DOCTYPE: Document type declaration”.

reader.cgi
    #-- 3 --
    # [ sys.stdout  +:=  (HTML header) + (blank line) +
    #                    (page as HTML) ]
    print HTML_HEADER
    print
    print DOCTYPE
    page.write ( sys.stdout, pretty_print=True )