Code

Ticket #2789: validators.py.diff

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

validators.py fix

Line 
1Index: validators.py
2===================================================================
3--- validators.py       (revision 3793)
4+++ validators.py       (working copy)
5@@ -356,7 +356,7 @@
6         if len(data) > max_allowed_length:
7             raise ValidationError, ngettext("Please enter a valid decimal number with at most %s total digit.",
8                 "Please enter a valid decimal number with at most %s total digits.", self.max_digits) % self.max_digits
9-        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)):
10+        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)):
11             raise ValidationError, ngettext( "Please enter a valid decimal number with a whole part of at most %s digit.",
12                 "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)
13         if '.' in data and len(data.split('.')[1]) > self.decimal_places: