Skip to content

Commit

Permalink
[#57] Delete old function
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmursa-dev committed Dec 30, 2024
1 parent 454080a commit 65ee076
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions vng_api_common/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,37 +156,6 @@ def validate_non_negative_string(value):
raise ValidationError("De waarde moet een niet-negatief getal zijn.")


validate_digits = RegexValidator(
regex="^[0-9]+$", message="Waarde moet numeriek zijn.", code="only-digits"
)


def validate_rsin(value):
"""
Validates that a string value is a valid RSIN number by applying the
'11-proef' checking.
:param value: String object representing a presumably good RSIN number.
"""
# Initial sanity checks.
validate_digits(value)
if len(value) != RSIN_LENGTH:
raise ValidationError(
"RSIN moet %s tekens lang zijn." % RSIN_LENGTH, code="invalid-length"
)

# 11-proef check.
total = 0
for multiplier, char in enumerate(reversed(value), start=1):
if multiplier == 1:
total += -multiplier * int(char)
else:
total += multiplier * int(char)

if total % 11 != 0:
raise ValidationError("Onjuist RSIN nummer.", code="invalid")


class URLValidator:
"""
Validate that the URL actually resolves to a HTTP 200
Expand Down

0 comments on commit 65ee076

Please sign in to comment.