Define a request parameters API that checks the param types
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
Medium
|
Francis J. Lacoste |
Bug Description
Form parameters are available in Zope3 in the request.form attribute. This attribute is a simple dictionary. But the types of the parameter can change based on the request. For example, if the parameter was specified more than once, it will be a list, otherwise a plan string (modulo the other automatic conversion done by python cgi module.)
This means that each call site should check that the parameter is a string or a list depending on what it expects. Otherwise, an error is sure to be raised... eventually. (See bug 57474 for an example.)
We should define a new form attribute that supports a getOne() and getAll() methods that make sure that the parameter is of the expected type. These methods would take care of raising UnexpectedFormData (which is the only appropriate exception to raise in that case).
Changed in launchpad: | |
assignee: | nobody → flacoste |
importance: | Undecided → Medium |
status: | Unconfirmed → Confirmed |
Work started on this.