Using Python for CGI programming
Overview
Why Python?
Basic Python tutorial
Tutorial outline
Interactive “shell”
Numbers
Strings
Lists
More list operations
Dictionaries
More dictionary ops
Dictionary details
Tuples
Variables
Reference semantics
Changing a shared list
Changing an integer
Control structures
Grouping indentation
Functions, procedures
Example function
Classes
Example class
Using classes
Subclassing
Subclassing (2)
Class & instance variables
Instance variable rules
Modules
Packages
Catching exceptions
Try-finally: cleanup
Raising exceptions
More on exceptions
File objects
Standard library
Python CGI programming
Outline
A typical HTML form
A typical CGI script
CGI script structure
Structure refinement
FieldStorage details
Other CGI niceties
Dealing with bugs
Debugging framework
Security notes
Using persistent data
Plain files
(G)DBM files
Shelves
Locking
A simple lock solution
Sessions
Cookies
Cookie example
File upload example
Generating HTML
CGI performance
Avoiding fork()
ZOPE
Case study
FAQ wizard
faqw.py - bootstrap
faqwiz.py - main code
Example: do_roulette()
Persistency
faqconf.py, faqcust.py
Webchecker
Reference URLs
Reference books
Any questions?
Nobody expects theSpanish Inquisition!
Email: guido@python.org
Home Page: http://www.python.org/~guido/
Download presentation source