[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

tools package. In a prior version, the call to the utility was wrapped in a commonhtml.run
silent call that prevents print call statements in the utility from showing up in the
HTML reply stream (they are just status messages, not HTML code). In this version,
we get the same capability from the “Silent” classes in mailtools. Figure 16-17 shows
a Delete operation in action.


Figure 16-17. PyMailCGI view page, Delete selected


By the way, notice the varied type of attachment parts on the mail’s page in Fig-
ure 16-17. In version 3.0 we can send only text attachments due to the Python 3.1 CGI
uploads parsing regression described earlier, but we can still view arbitrary attachment
types in fetched mails received from other senders. This includes images and PDFs.
Such attachments open according to your browser’s conventions; Figure 16-18 shows
how Chrome handles a click on the monkeys.jpg link at the bottom of the PyMailCGI
page in Figure 16-17—it’s the same image we sent by FTP in Chapter 13 and via Py-
MailGUI in Chapter 14, but here it has been extracted by a PyMailCGI CGI script and
is being returned by a locally running web server.


Back to our pending deletion. As mentioned, Delete is the only action that uses the
POP account information (user, password, and site) that was passed in from hidden
fields on the prior message view page. By contrast, the Reply and Forward actions


Processing Fetched Mail| 1269
Free download pdf