Re: InternationalPhoneNumber
W-Mark Kubacki <wmark-/[email protected]> Sat, 18 Oct 2008 19:45:30 +0200
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <2C8837732ABE5746BADC1321F498A3F56020011BF0@chlorium> |
>From: Stéphane Raimbault [mailto:[email protected]] > >I propose to replace this: > >for f, t in [(' ', ' '), ('--', '-'), (' - ', '-'), ('- ', '-'), (' -', >'-')]: > value = value.replace(f, t) >value = value.replace(' ', '') > >by > >value = value.replace(' ', '') >value = value.replace('--', '-') > >Simpler, faster! Your suggestion would remove free spaces as well - which are regarded as delimiters in this case. The pre-transformations require these delimiters to detect e.g., directory numbers correctly. Omitting them makes only sense in the French and Spanish numbers you've mentioned. Shall we collect country codes (i.e., +49, +33...) for countries which tolerate numbers like +##-######## (without directory numbers) or shall I only add an option "directory_number_optional"? -- 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