MCPcopy
hub / github.com/django/django / _simple_domain_name_validator

Function _simple_domain_name_validator

django/contrib/sites/models.py:12–22  ·  view source on GitHub ↗

Validate that the given value contains no whitespaces to prevent common typos.

(value)

Source from the content-addressed store, hash-verified

10
11
12def _simple_domain_name_validator(value):
13 """
14 Validate that the given value contains no whitespaces to prevent common
15 typos.
16 """
17 checks = ((s in value) for s in string.whitespace)
18 if any(checks):
19 raise ValidationError(
20 _("The domain name cannot contain any spaces or tabs."),
21 code="invalid",
22 )
23
24
25class SiteManager(models.Manager):

Callers

nothing calls this directly

Calls 1

ValidationErrorClass · 0.90

Tested by

no test coverage detected