through states such as web pages (e.g., dataflow diagrams), but for this simple example,
this file gets the job done.
Example 16-1. PP4E\Internet\Web\PyMailCgi\pageflow.txt
file or script creates
[pymailcgi.html] Root window
=> [onRootViewLink.py] Pop password window
=> [onViewPswdSubmit.py] List window (loads all pop mail)
=> [onViewListLink.py] View Window + pick=del|reply|fwd (fetch)
=> [onViewPageAction.py] Edit window, or delete+confirm (del)
=> [onEditPageSend.py] Confirmation (sends smtp mail)
=> back to root
=> [onRootSendLink.py] Edit Window
=> [onEditPageSend.py] Confirmation (sends smtp mail)
=> back to root
This file simply lists all the source files in the system, using => and indentation to denote
the scripts they trigger.
For instance, links on the pymailcgi.html root page invoke onRootViewLink.py and
onRootSendLink.py, both executable scripts. The script onRootViewLink.py generates
a password page, whose Submit button in turn triggers onViewPswdSubmit.py, and so
on. Notice that both the view and the send actions can wind up triggering
onEditPageSend.py to send a new mail; view operations get there after the user chooses
to reply to or forward an incoming mail.
In a system such as this, CGI scripts make little sense in isolation, so it’s a good idea
to keep the overall page flow in mind; refer to this file if you get lost. For additional
context, Figure 16-1 shows the overall contents of this site, viewed as directory listings
under Cygwin on Windows in a shell window.
When you install this site, all the files you see here are uploaded to a PyMailCgi sub-
directory of your web directory on your server’s machine. Besides the page-flow HTML
and CGI script files invoked by user interaction, PyMailCGI uses a handful of utility
modules:
commonhtml.py
Provides a library of HTML tools
externs.py
Isolates access to modules imported from other places
loadmail.py
Encapsulates mailbox fetches for future expansion
secret.py
Implements configurable password encryption
The PyMailCGI Website | 1231