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

10.29. hist.cgi: foContent(): Generate the index and main table

hist.cgi
# - - -   f o C o n t e n t

def foContent(s, db, circleList, cbcHist):
    '''Generate the flow content.

      [ (s is a sox.Sox instance) and
        (circleList is a list of pycbc.Circle instances) and
        (cbcHist is a lib.CbcHist instance) ->
          s  +:=  (primary index entries displaying circleList) +
              (a table displaying cbcHist) ]
    '''

The first part of the content is the list of circles with their coordinates and year lists. We first build an instance of Section 22, “class PriIndex: Primary regional index entry”, which retrieves the years from db. Then we call Section 22.6, “PriIndex.foMain(): Generate a primary index as XSL-FO” to format it as XSL-FO.

hist.cgi
    #-- 1
    # [ s  +:=  primary index entries for circles in circleList
    #       using years from (db), as XSL-FO ]
    for circle in circleList:
        #-- 1 body
        # [ circle is a pycbc.Circle instance ->
        #     s  +:=  a primary index entry for (circle) using
        #         years from (db), as XSL-FO ]
        priIndex = lib.PriIndex(db, circle,
            firstYear=HistArgs().firstYear,
            lastYear=HistArgs().lastYear)
        priIndex.foMain(s)

The main table is built by Section 10.30, “hist.cgi: foTable(): Format the main table”.

hist.cgi
    #-- 2
    # [ s  +:=  a table-body representing cbcHist ]
    foTable(s, cbcHist)