jim/web.py - addition of a phone number formatting routine/phone number check
jim/web.py - addition of a phone number formatting routine/phone number check

The function format_phone_number(phone_number) was defined to help check
the input format, and to convert the input into a standard format, i.e.,
xxx-xxx-xxxx. Note that this function can handle all kinds of strings
with 10 digits, e.g., (908) 123 4567, or 908.123-4567. If the number
does not contain 10 digits, it is rejected and None is returned. In
one instance (home_phone), an if-statement is placed in the parser;
for the cell phone and work phone number, the function format_phone_number
is invoked. An error message is generated if a phone number was provided
where the nunber of digits is not equal to 10. It is possible to further
extend this to also accept international phone numbers, and/or to
perform additional checks on the US phone numbers. One may also want
to employ a package, e.g., python-phonenumbers.

Signed-off-by: Adriaan van Wijngaarden <b1112bd3dd1dff79f63cda434e713ed36d32abf6@gmail.com>

ihadzic/jim,ihadzic/jim,ihadzic/jim