Ticket #2789: validators.py.diff

File validators.py.diff, 1.2 KB (added by volodya@…, 18 years ago)

validators.py fix

  • validators.py

     
    356356        if len(data) > max_allowed_length:
    357357            raise ValidationError, ngettext("Please enter a valid decimal number with at most %s total digit.",
    358358                "Please enter a valid decimal number with at most %s total digits.", self.max_digits) % self.max_digits
    359         if (not '.' in data and len(data) > (self.max_allowed_length - self.decimal_places)) or ('.' in data and len(data) > (self.max_digits - (self.decimal_places - len(data.split('.')[1])) + 1)):
     359        if (not '.' in data and len(data) > (max_allowed_length - self.decimal_places)) or ('.' in data and len(data) > (self.max_digits - (self.decimal_places - len(data.split('.')[1])) + 1)):
    360360            raise ValidationError, ngettext( "Please enter a valid decimal number with a whole part of at most %s digit.",
    361361                "Please enter a valid decimal number with a whole part of at most %s digits.", str(self.max_digits-self.decimal_places)) % str(self.max_digits-self.decimal_places)
    362362        if '.' in data and len(data.split('.')[1]) > self.decimal_places:
Back to Top