This function builds the access report page showing all the access statistics for URLs belonging to a given account name. It also adds a link to this page from the parent letter page.
# - - - a d d P e r s o n a l R e p o r t
def addPersonalReport ( ul, userName, accessSummary ):
'''Build the access report page for one person's account.
[ (ul is an et.Element) and
(userName is a personal account name) and
(accessSummary is an AccessSummary instance) ->
ul +:= an 'li' element containing a link to a
personal-report page for (userName)
personal-report for (userName) := personal-content
for (userName) ]
'''
First compute the location of the page in URL and file
space. The path is at (userName +
HTML_EXT) relative to PERSONAL_WEB_PATH. For these paths, see Section 6.3, “Web paths”.
#-- 1 --
# [ webPath := a WebPath instance representing userName's
# page relative to PERSONAL_WEB_PATH ]
fileName = userName + HTML_EXT
webPath = PERSONAL_WEB_PATH.relative ( fileName )
Next we build the link from the letter page to the new page.
#-- 2 --
# [ ul +:= an 'li' element containing a link to webPath ]
linkText = "%s~%s" % (NMT_WEB_PATH.url, userName)
ul.append (
E.li (
E.a ( linkText, href=webPath.url ) ) )
For the actual construction of the user report page,
see Section 20, “buildReportPage(): Build one access
report page”.
#-- 3 --
# [ personal-report for (userName) := personal-content
# for (userName) from accessSummary at webPath ]
buildReportPage ( userName, webPath, "~", accessSummary,
accessSummary.genPersonUrls )