Opened 19 months ago
Closed 19 months ago
#34503 closed Bug (invalid)
Missleading message in MinValueValidator and MaxValueValidator
Reported by: | bartektrybala | Owned by: | nobody |
---|---|---|---|
Component: | Core (Serialization) | Version: | 4.2 |
Severity: | Normal | Keywords: | MaxValueValidator, MinValueValidator, message, less or equal |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Here is a message error for MaxValueValidator:
message = _("Ensure this value is less than or equal to %(limit_value)s.")
but compare method checks if a < b. So it's not accurate comparision or message, It should checks a <= b, isn't it?
The same for MinValueValidator
Change History (2)
comment:1 by , 19 months ago
Easy pickings: | set |
---|
comment:2 by , 19 months ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Sorry I think you may have misread the code.
Here is MaxValueValidator:
Here a is the cleaned value while b is the limit. If compare is True then a ValidationError is raised. The inverse of this comparison is therefore correct: cleaned value must be less than or equal to the limit.