Escaping text like this isn’t always required, but it is a good rule of thumb when its
content isn’t known; scripts that generate HTML have to respect its rules. As we’ll see
later in this book, a related call, urllib.parse.quote, applies URL escaping rules to text.
As we’ll also see, larger frameworks often handle text formatting tasks for us.
A Web-Based Shelve Interface
Now, to use the CGI techniques of the prior sections for our database application, we
basically just need a bigger input and reply form. Figure 1-14 shows the form we’ll
implement for accessing our database in a web browser.
Figure 1-14. peoplecgi.html input page
Coding the website
To implement the interaction, we’ll code an initial HTML input form, as well as a
Python CGI script for displaying fetch results and processing update requests. Exam-
ple 1-33 shows the input form’s HTML code that builds the page in Figure 1-14.
Example 1-33. PP4E\Preview\peoplecgi.html