Ticket #11825: flavourpath.diff
File flavourpath.diff, 1.1 KB (added by , 15 years ago) |
---|
-
trunk/django/contrib/localflavor/pl/forms.py
55 55 """ 56 56 multiple_table = (1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 1) 57 57 result = 0 58 for i in range(len(number) ):58 for i in range(len(number)-1): 59 59 result += int(number[i]) * multiple_table[i] 60 60 return result % 10 == 0 61 61 … … 78 78 79 79 def clean(self,value): 80 80 super(PLNIPField, self).clean(value) 81 if not value: 82 return '' 81 83 value = re.sub("[-]", "", value) 82 84 if not self.has_valid_checksum(value): 83 85 raise ValidationError(self.error_messages['checksum']) … … 116 118 117 119 def clean(self,value): 118 120 super(PLREGONField, self).clean(value) 121 if not value: 122 return '' 119 123 if not self.has_valid_checksum(value): 120 124 raise ValidationError(self.error_messages['checksum']) 121 125 return u'%s' % value