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

9. buildServerTable(): Build the table of servers

This function build the table of servers. It starts by building the constant parts of the table, including an empty tbody element. For a summary of the XHTML we are building, see Section 3.1, “XHTML for the start page”.

hwscan3.py
# - - -   b u i l d S e r v e r T a b l e

def buildServerTable ( parent, reportInfo, clientSet ):
    '''Build the table of login servers.

      [ (parent is an et.Element) and
        (reportInfo is a ReportInfo) and
        (clientSet is a ClientSet) ->
          parent  +:=  a table showing servers named in reportInfo,
                       with configuration data from clientSet ]
    '''

See Section 6.22, “TABLE_ATTRS for a constant dictionary that defines standard table decorations.

hwscan3.py
    #-- 1 --
    # [ parent  +:=  an h2 subhead ]
    parent.append ( E.h2 ( 'Linux servers for remote login' ) )

    #-- 2 --
    # [ parent  +:=  an XHTML table as an et.Element, with an
    #                empty tbody element
    #   tbody  :=  that empty tbody element ]
    table  =  E.table (
        TABLE_ATTRS,
        E.col ( TOP_VALIGN, R_ALIGN ),
        E.col ( TOP_VALIGN, R_ALIGN ),
        E.col ( TOP_VALIGN, L_ALIGN ),
        E.col ( TOP_VALIGN, R_ALIGN ),
        E.thead (
            E.tr (
                E.th ( 'Name' ),
                E.th ( '# CPUs' ),
                E.th ( 'Speed (MHz)' ),
                E.th ( 'Architecture' ),
                E.th ( 'Memory (MB)' ) ) ) )
    tbody  =  et.SubElement ( table, 'tbody' )
    parent.append ( table )

For the logic that locates, sorts, and displays the login servers, see Section 10, “findLoginServers(): Display login server rows”.

hwscan3.py
    #-- 3 --
    # [ tbody  +:=  tr elements containing one row for each
    #       login server named in reportInfo, with configuration
    #       data from clientSet ]
    findLoginServers ( tbody, reportInfo, clientSet )