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

21. buildOfficialSide(): Build access reports for official directories

This function builds all the access report pages for official directories, as well as the links to those pages from the index page.

webstats.py
# - - -   b u i l d O f f i c i a l S i d e

def buildOfficialSide ( cell, accessSummary ):
    '''Build all official access reports.

      [ (cell is an et.Element) and
        (accessSummary is an AccessSummary instance) ->
          cell  +:=  links to official-reports(accessSummary) ]
          official-reports(accessSummary)  :=
              official-content(accessSummary) ]
    '''

The generation of official access reports is driven by accessSummary.genOfficials(), which generates all the official directory names in ascending order.

webstats.py
    #-- 1 --
    for dirName in accessSummary.genOfficials():
        #-- 1 body --
        # [ cell  +:=  link to official-report for dirName
        #   official-report for dirName  :=  official-content
        #       for dirName from accessSummary ]

        #-- 1.1 --
        # [ officialWebPath  :=  WebPath for official-report
        #       for (dirName) ]
        relPath  =  dirName + HTML_EXT
        officialWebPath  =  OFFICIAL_WEB_PATH.relative ( relPath )

        #-- 1.2 --
        # [ cell  +:=  link to officialWebPath using link text
        #       (NMT_WEB_PATH + dirName + "/") ]
        linkText  =  "%s%s/..." % (NMT_WEB_PATH.url, dirName)
        cell.append (
            E.div (
                E.a ( linkText, href=officialWebPath.url ) ) )

        #-- 1.3 --
        # [ official-report for dirName  :=  official-content
        #       for dirName from accessSummary ]
        buildReportPage ( dirName, officialWebPath, "",
            accessSummary, accessSummary.genOfficialUrls )