#34503: Missleading message in MinValueValidator and MaxValueValidator
-------------------------------------+-------------------------------------
     Reporter:  bartektrybala        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Core                 |                  Version:  4.2
  (Serialization)                    |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  MaxValueValidator,   |             Triage Stage:
  MinValueValidator, message, less   |  Unreviewed
  or equal                           |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by David Sanders):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 Sorry I think you may have misread the code.

 Here is MaxValueValidator:

 {{{
 class MaxValueValidator(BaseValidator):
     message = _("Ensure this value is less than or equal to
 %(limit_value)s.")
     code = "max_value"

     def compare(self, a, b):
         return a > b
 }}}

 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.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34503#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018798c311c1-a5185b4d-57c1-4714-bbe3-7d794fc7ccb1-000000%40eu-central-1.amazonses.com.

Reply via email to