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

22. class PriIndex: Primary regional index entry

Each primary entry on the regional index page corresponds to, and is produced by, an instance of this class. The constructor retrieves the effort records for the specified circles from the database, but ignores efforts outside the specified

cbchistlib.py
# - - - - -   c l a s s   P r i I n d e x

class PriIndex(BaseIndex):
    '''Primary regional page index entry.

      Exports:
        PriIndex(db, circle, firstYear=MIN_YEAR, lastYear=MAX_YEAR,
                 isOverlap=False):
          [ (db is a pycbc.CBCDatabase instance) and
            (circle is a pycbc.Circle instance) and
            (start_year is year-number format(the first included year
            number)) and
            (end_year is year-number format(the last included year
            number) and
            (isOverlap is True iff overlap report is desired) ->
              return a PriIndex representing circle and related circles
              from db, ignoring years outside [start_year, end_year] ]
        .db:         [ as passed to constructor, read-only ]
        .circle:     [ as passed to constructor, read-only ]
        .firstYear:  [ as passed to constructor, read-only ]
        .lastYear:   [ as passed to constructor, read-only ]
        .effortList:
          [ list of Effort instances for this circle that fall in
            year number range [firstYear, lastYear], sorted by
            (year_no, year_key) ]

In addition to the methods inherited from BaseIndex, this class exports two methods used to generate parts of the XHTML rendering. These methods are exposed so that selected circle index entries can appear before the main table on the history detail page.

cbchistlib.py
        .htmlMain(parent):
          [ parent is an et.Element ->
              parent  :=  parent with new XHTML added representing
                  a primary entry containing a submit button
                  for (circle)
        .htmlAs(parent):
          [ parent is an et.Element ->
              parent  :=  parent with new XHTML added representing
                  the "As" lines of self ]

The next two methods are used by hist.cgi. The .soxMain() method is used to generate XHTML circle index entries using the sox interface. The .foMain() method generates XSL-FO circle index entries using the sox interface and the fosox helper module.

cbchistlib.py
        .soxMain(s):
          [ s is a sox.Sox instance ->
              s  +:=  a div element containing the primary index
                      entry for self as XHTML ]
        .foMain(s):
          [ s is a sox.Sox instance ->
              s  +:=  a block element containing the primary index
                      entry for self as XSL-FO ]
    '''