By Guido van Rossum
Overview
- 1 minute advocacy
- 30 minutes basic Python tutorial
- 30 minutes on Python CGI programming
- 30 minutes CGI case study: FAQ wizard
- Spanish Inquisition
Python CGI programming Outline
- HTML forms
- Basic CGI usage
- Setting up a debugging framework
- Security
- Handling persistent data
- Locking
- Sessions
- Cookies
- File upload
- Generating HTML
- Performance
CGI script structure
- Check form fields
–use cgi.FieldStorage class to parse query
•takes care of decoding, handles GET and POST
•"foo=ab+cd%21ef&bar=spam" -->{'foo': 'ab cd!ef', 'bar': 'spam'} # (well, actually, ...) - Perform action
–this is up to you!
–database interfaces available - Generate HTTP + HTML output
–print statements are simplest
–template solutions available