Here is an intended function for the entire script. Not mentioned here is a blanket precondition that the LDAP server is available; if it isn't, nothing else is likely to be working.
# - - - m a i n def main(): '''Build a KWIC index to all TCC personal homepages. [ if (command line arguments are valid) and (directory specified on command line is writeable) -> directory specified on command line := index.html top-level page and index_X.html subpages for every letter X of the alphabet else -> sys.stderr +:= error message(s) ] '''
#-- 1 -- # [ if command line arguments are valid -> # dirPath := absolute pathname to directory specified on # command line # else -> # sys.stderr +:= error message(s) # stop execution ] dirPath = checkArguments()
The work progresses in two main phases: accumulating the
information for each user into a
instance, and building the index pages.
Section 26, “
class WebUser: Encapsulate user data” defines the class that
encapsulates the relevant data for one user.
Section 7.3, “
LDAP_SERVER” is the name of the LDAP
#-- 2 -- # [ kwicIndex := a kwic.KwicIndex instance indexing the names of # users in LDAP_SERVER who have a readable WEB_DIR # subdirectory, with the user data for each user # represented as a WebUser instance ] kwicIndex = buildKwic()
#-- 3 -- # [ if directory (dirPath) is writeable -> # directory (dirPath) := (file INDEX_NAME containing links # to letter pages) + (one page for each letter (X), named # LETTER_PAGE_NAME+(X)+HTML_SUFFIX, displaying the # entries in kwicIndex that start with (X) # else -> # sys.stderr +:= error message(s) ] buildAllPages(dirPath, kwicIndex)