[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
When this form’s Submit button (labeled “Send” by the page’s HTML) is pressed, it causes the script in Example 15-10 to be execu ...
Figure 15-11. Reply page generated by tutor4.py As usual, we can pass parameters to this CGI script at the end of a URL, too. Fi ...
Although Example 15-10 doesn’t introduce much that is new about CGI itself, it does highlight a few new coding tricks worth noti ...
Test case mock-up The dummy class definition, commented out in this final version, was used to debug the script before it was in ...
display the exception’s name and value in the response page; exception details are available in the built-in sys module, from sy ...
Developer Manager Student Evangelist Other Political affiliations: Pythonista Perlmonger Tcler Comments: Enter text here ...
This page contains a simple text field as before, but it also has radio buttons, a pull- down selection list, a set of multiple- ...
String formatting We’re using dictionary key references in the format string this time—recall that % (name)s means pull out the ...
Please complete the following form and click Submit Name: Shoe size: Small Medium Large Occupation: Developer Manager Stu ...
When we visit this alternative page with a browser, we get the interface shown in Figure 15-15. Figure 15-15. Form page cr ...
Figure 15-16. Response page created by tutor5.py (2) Keeping display and logic separate In fact, this illustrates an important p ...
code is separate components. Search the Web for more details. Similar techniques can be used for separation of layout and login ...
This static HTML file defines three hyperlinks—the first two are minimal and the third is fully specified, but all work similarl ...
The query parameters in the URLs embedded in Example 15-14 were hardcoded in the page’s HTML. But such URLs can also be generate ...
script, to pass data on to the next script on submit; hidden form fields provide another way to save state between pages. ...
Saving State Information in CGI Scripts One of the most unusual aspects of the basic CGI model, and one of its starkest con- tra ...
last two sections, generating query parameters on URL links and hidden form fields in input pages sent as replies are two simple ...
CGI model extensions Persistent processes, session management, and so on We’ll explore most of these in later examples, but sinc ...
to the next script along with any real inputs, to serve as context. The net effect provides context for an entire input form, no ...
data is embedded in the data streams much like query parameters and form fields, but it is contained in HTTP headers, not in a p ...
«
56
57
58
59
60
61
62
63
64
65
»
Free download pdf