Re: InternationalPhoneNumber
W-Mark Kubacki <wmark-/[email protected]> Thu, 16 Oct 2008 14:38:08 +0200
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <2C8837732ABE5746BADC1321F498A3F56020011BEA@chlorium> |
> From: Stéphane Raimbault [mailto:[email protected]] > > In France, the regional code is 33 (+33) so when I enter an French phone > number with 10 digits, this test must be valid : >>> c = InternationalPhoneNumber(default_cc=33) >>> c.to_python('02 43 92 34 18') > '+33-243923418' > > What do you think about this test? It does test for an invalid return value. Telephone numbers, in international notation, have to consist of a call prefix (e.g., country code +33), directory number and finally the local part number, optionally with one (!) extension. Your example is missing the middle part, the directory number. Unfortunately they are not explicitly written in France, thus all seem to consist of ten numbers (Monaco: eight). Correct me if I am wrong, but you still have them: 2 is for Angers, Brest, Caen, Cherbourg, Nantes, Tours, Rouen... So your number has to be entered as follows: +33-2-43923418 If this looks too strange to you, we should consider writing a dedicated validator for French numbers. Of course, my implementation of the IPV has its limitations. For example, the NANP (North American Numbering Plan) is missing some countries you can dial from Europe, and some other countries/governments insist on their own notation (e.g., dots or slashes instead of dashes) or have their own nomenclature (see ISO, ITU...). It is meant to suit the de-facto standard for most of FE's users. > How I can run the doctests of FormEncode? In this case: nosetests --with-doctest formencode.national -- Mark ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ FormEncode-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/formencode-discuss