#23639 closed Bug (fixed)
Doc error in RegexValidator.regex
Reported by: | Claude Paroz | Owned by: | doriczapari |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
In https://docs.djangoproject.com/fr/1.7/ref/validators/#django.core.validators.RegexValidator.regex, I think that the effects of inverse_match
are reversed. A ValidationError
is raised when inverse_match=True
and a match is found. Can someone confirm? Boolean logic, we love you!
Change History (6)
comment:1 by , 10 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 10 years ago
Suggested patch:
-
docs/ref/validators.txt
diff --git a/docs/ref/validators.txt b/docs/ref/validators.txt index 260c066..0b66dd2 100644
a b to, or in lieu of custom ``field.clean()`` methods. 81 81 .. attribute:: regex 82 82 83 83 The regular expression pattern to search for the provided ``value``, 84 or a pre-compiled regular expression. Raises a84 or a pre-compiled regular expression. By default, raises a 85 85 :exc:`~django.core.exceptions.ValidationError` with :attr:`message` 86 and :attr:`code` if :attr:`inverse_match` is ``False`` and a match is 87 found, or if :attr:`inverse_match` is ``True`` and a match is not found. 88 By default, matches any string (including an empty string). 86 and :attr:`code` if a match is not found. That standard behavior might 87 be reversed by setting :attr:`inverse_match` to ``True``, meaning that 88 the :exc:`~django.core.exceptions.ValidationError` is raised when a 89 match **is** found. By default, matches any string (including an empty 90 string). 89 91 90 92 .. attribute:: message
comment:3 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 10 years ago
Has patch: | set |
---|
Here's the pull request: https://github.com/django/django/pull/3346
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Hi,
You're right (and I also find this sentence really hard to parse, but maybe that's just me):
I wouldn't be opposed to a rewrite of this paragraph since I find it quite confusing.