misc: check SIREN code for ASCII digits (#42808)

This commit is contained in:
Frédéric Péters 2020-05-13 10:04:27 +02:00
parent 4c097aa37b
commit 3690d3c987
2 changed files with 6 additions and 1 deletions

View File

@ -737,6 +737,11 @@ def test_wcsextrastringwidget_siren_validation():
mock_form_submission(req, widget, {'test': 'XXX170130'})
assert widget.has_error()
widget = WcsExtraStringWidget('test', value='foo', required=False)
widget.field = fakefield
mock_form_submission(req, widget, {'test': '443170¹39'})
assert widget.has_error()
def test_wcsextrastringwidget_siret_validation():
class FakeField: pass

View File

@ -685,7 +685,7 @@ def validate_luhn(string_value, length=None):
return False
if length is not None and len(string_value) != length:
return False
if not string_value.isdigit():
if not is_ascii_digit(string_value):
return False
# take all digits counting from the right, double value for digits pair