Utility to force conversion to integer
Bug #542963 reported by
foxbunny
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
web.py |
New
|
Undecided
|
Unassigned |
Bug Description
Sometimes I get user input or other inputs in non-integer form (string, float, etc). In case of strings, and possibly some other cases, simple int(blah) doesn't work, so the error has to be trapped.
This patch introduces a tool, utils.forceint, that will force conversion to integer no matter what, for all those mission critical situations. If conversion cannot be done, 0 is returned, or a different default value specified by the programmer.
To post a comment you must log in.