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

13. accessReport(): Start a new access report table

Access reports occur in several places. Each has the same format: total hits, off-campus percent, and URL.

webstats.py
# - - -   a c c e s s R e p o r t

def accessReport ( parent ):
    '''Build a new access report

      [ parent is an et.Element ->
          parent  +:=  a new access report as a 'table' element
          return the 'tbody' element of that table ]
    '''
    #-- 1 --
    # [ parent  +:=  a new, empty 'tbody' element ]
    #   tbody  :=  that element ]
    tbody  =  E.tbody()

    #-- 2 --
    # [ table  :=  a new 'table' element with three columns,
    #       headings for an access report, and tbody as its
    #       'tbody' element ]
    table  =  E.table ( TABLE_ATTRS,
                E.col ( R_ALIGN ),
                E.col ( R_ALIGN ),
                E.col ( L_ALIGN ),
                E.thead (
                  E.th ( "Total" ),
                  E.th ( "Offsite" ),
                  E.th ( "URL" ) ),
                tbody )
    parent.append ( table )

    #-- 3 --
    return tbody