misc: reinforce french phonenumber validation (#73860)
This commit is contained in:
parent
eb70e9eb43
commit
f22e7b4ad7
|
@ -647,6 +647,7 @@ def test_validate_phone_fr():
|
|||
'1234559',
|
||||
'+32123456789',
|
||||
'01+23+45+67+89',
|
||||
'tel 0143350133',
|
||||
]
|
||||
|
||||
assert all(validate_phone_fr(pn) for pn in valid)
|
||||
|
|
|
@ -835,6 +835,9 @@ def is_ascii_digit(string_value):
|
|||
|
||||
|
||||
def validate_phone_fr(string_value):
|
||||
if not re.match(r'^[0\+][\d\.\s]+$', string_value):
|
||||
# leading zero or +, then digits, dots, or spaces
|
||||
return False
|
||||
french_country_codes = [33, 262, 508, 590, 594, 596]
|
||||
pn = None
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue