Utility to force conversion to integer

Bug #542963 reported by foxbunny
6
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.

Revision history for this message
foxbunny (bg-branko) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.