[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
The Root Page Let’s start off by implementing a main page for this example. The file shown in Exam- ple 16-2 is primarily used t ...
New in Version 2: PyMailCGI now supports viewing and sending Email attachments for a single user, and avoids some of the prior v ...
accounts without either typing an explicit and unsafe URL or doing a bit of installation and configuration. This is on purpose, ...
pages that let users read, reply to, forward, and delete existing email. Since the Send function is the simplest, let’s start wi ...
Example 16-4. PP4E\Internet\Web\PyMailCgi\cgi-bin\onEditPageSend.py !/usr/bin/python """ ####################################### ...
os.mkdir(savedir) def saveAttachments(form, maxattach=3, savedir=savedir): """ save uploaded attachment files in local files on ...
bodyencoding = 'ascii' try: text.encode(bodyencoding) # try ascii first (or latin-1?) except (UnicodeError, LookupError): # else ...
Notice that there are no usernames or passwords to be found here; as we saw in Chap- ter 13, SMTP usually requires only a server ...
Most important, if we ever change the header and footer format functions in the commonhtml module, all our page’s headers and fo ...
will indeed send an email message as specified by the input parameters at the end. That URL string is a lot to type into a brows ...
<a href="../pymailcgi.html">Back to root page</a> </body></html> The HTML reply printed by this script w ...
The POP Password Page If you flip back to the main page in Figure 16-2, you’ll see a View link; pressing it triggers the script ...
(in server-side templating tools such as PSP the effect is similar, but Python code is embedded in HTML code instead and run to ...
""" import cgi import loadmail, commonhtml from externs import mailtools from secret import encode # user-defined encoder module ...
commonhtml.listpage Generates HTML to display a passed-in list of tuples (text, URL, parameter- dictionary) as a list of hyperli ...
Figure 16-9 shows one that gives the Python exception and details as part of the reply after a Python-raised exception is caught ...
limitations, here is what one of those link lines looks like, reformatted with line breaks and spaces to make it easier to under ...
>>> import urllib.parse >>> urllib.parse.quote_plus("There's bugger all down here on Earth") 'There%27s+bugger ...
In contrast, PyMailCGI runs on the web server machine and simply displays mail text on the client’s browser—mail is downloaded f ...
devised to minimize the chance that email account information could be stolen off the Net in transit. Here’s how it works. When ...
«
60
61
62
63
64
65
66
67
68
69
»
Free download pdf