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

8.5. regx.cgi: buildRegionsForm: Build the regional index form

regx.cgi
# - - -   b u i l d R e g i o n s F o r m

def buildRegionsForm(page, db):
    '''Main page construction logic for the regional index form.

      [ (page is a tp.TCCPage instance) and
        (db is a pycbc.CBCDatabase instance) ->
          if RegArgs() is consistent with db ->
            page  :=  page modified to display a page that allows
                the user to select history reports from the set of
                circles in db selected by RegArgs()
          else -> raise ScriptError ]
    '''

This function builds the body of the regional index page. There are three principal parts:

regx.cgi
    #-- 1
    # [ if RegArgs().reg_code is a region code in db ->
    #     page  :=  page with its titles change to show the
    #               corresponding region
    #   else -> raise ScriptError ]
    buildRegionTitles(page, db)

    #-- 2
    # [ page  :=  page with the regional index form added except for
    #             the index entries ]
    form = startForm(page)

    #-- 3
    # [ form  :=  form with index entries added falling within the
    #             year range specified by RegArgs() ]
    buildIndexSection(form, db, RegArgs().firstYear, RegArgs().lastYear,
                      RegArgs().isOverlap)