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

17. buildErrorPage()

In the TCCPage instance, the headTitle and bodyTitle attributes are writeable, so that we can change the title and heading after the page has been created but before it is serialized. The content atttribute is a div to hold the page content.

cbchistlib.py
# - - -   b u i l d E r r o r P a g e

def buildErrorPage(page, x):
    '''Modify the page to show an error message.

      [ (page is a tp.TCCPage instance) and (x is an Exception) ->
          page  :=  page modified to display str(x) as an error ]
    '''
    page.headTitle.text = "Script error"
    page.bodyTitle.text = "Script error"
    page.content.text = "Error: %s" % str(x)