# - - - - - h w s c a n . p y - - m a i n - - - - -
def main():
'''Main program.
[ (ldap0.nmt.edu contains client info) and
(the GetHardware XML-RPC interface has hardware
configuration data) ->
start page := (table of servers) + (list of open lab
rooms with links to open lab room pages) +
(table of classrooms with links to classroom room
pages)
room pages for all open labs and classrooms :=
tables of clients in each room ]
'''
The first step is to instantiate the two important data
sources, the ReportInfo and ClientSet instances. We create the ReportInfo instance with the miscellaneous
report data first, because the the ClientSet instance needs the list of peripheral devices types
from scanreport.xml.
#-- 1 --
# [ if REPORT_FILE names a readable, valid file conforming to
# scanreport.rnc ->
# return a new ReportInfo object representing that file
# else ->
# sys.stderr +:= error message
# stop execution ]
print >>sys.stderr, ( "=== %s %s ===" %
(SCRIPT_NAME, EXTERNAL_VERSION) )
try:
reportInfo = ReportInfo ( REPORT_FILE )
except IOError, detail:
print >>sys.stderr, ( "*** Can't read the report information "
"file '%s': %s" % (REPORT_FILE, detail) )
raise SystemExit
#-- 2 --
# [ (ldap0.nmt.edu contains client info) and
# (the GetHardware XML-RPC interface has hardware
# configuration data) ->
# clientSet := the singleton ClientSet() instance
# representing these data ]
clientSet = ClientSet(reportInfo)
For the logic that generates all the Web pages, see
Section 8, “buildPages(): Build all Web pages”.
#-- 3 --
# [ start page := (table of servers from clientSet) +
# (list of open lab rooms from reportInfo with links to
# open lab room pages from clientSet) +
# (table of classrooms from reportInfo with links to
# classroom room pages from clientSet)
# room pages for all open labs and classrooms :=
# tables of clients in each room from clientSet ]
buildPages ( reportInfo, clientSet )