Ticket #11825: flavourpath.diff

File flavourpath.diff, 1.1 KB (added by Maksymus007, 15 years ago)
  • trunk/django/contrib/localflavor/pl/forms.py

     
    5555        """
    5656        multiple_table = (1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 1)
    5757        result = 0
    58         for i in range(len(number)):
     58        for i in range(len(number)-1):
    5959            result += int(number[i]) * multiple_table[i]
    6060        return result % 10 == 0
    6161
     
    7878
    7979    def clean(self,value):
    8080        super(PLNIPField, self).clean(value)
     81        if not value:
     82                return ''
    8183        value = re.sub("[-]", "", value)
    8284        if not self.has_valid_checksum(value):
    8385            raise ValidationError(self.error_messages['checksum'])
     
    116118
    117119    def clean(self,value):
    118120        super(PLREGONField, self).clean(value)
     121        if not value:
     122                return ''
    119123        if not self.has_valid_checksum(value):
    120124            raise ValidationError(self.error_messages['checksum'])
    121125        return u'%s' % value
Back to Top