Posted by: Anonymous
[ip: 75.72.96.53]
on June 04, 2008 04:05 PM
Don't forget to validate your input. Even in this trivial example, just because the form fields are checkboxes doesn't prevent someone from posting "laptops=foo" to the script, which will make the int() function call raise an exception. To handle those cases, I like to extend FieldStorage with a small getint() method, which works like getvalue() but will check for non-ints and return a default for those cases.
An introduction to CGI scripting with Python
Posted by: Anonymous [ip: 75.72.96.53] on June 04, 2008 04:05 PM#