Skip to content

Commit

Permalink
Fixed #6291 -- Fixed error in CASocialInsuranceNumberField documentat…
Browse files Browse the repository at this point in the history
…ion and error message. Thanks, jeff+django@ivany.org and arien

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6985 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Jan 2, 2008
1 parent aa72842 commit f633673
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions django/contrib/localflavor/ca/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ class CASocialInsuranceNumberField(Field):
Checks the following rules to determine whether the number is valid:
* Conforms to the XXX-XXX-XXXX format.
* Conforms to the XXX-XXX-XXX format.
* Passes the check digit process "Luhn Algorithm"
See: http://en.wikipedia.org/wiki/Social_Insurance_Number
"""
default_error_messages = {
'invalid': ugettext('Enter a valid Canadian Social Insurance number in XXX-XXX-XXXX format.'),
'invalid': ugettext('Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.'),
}

def clean(self, value):
Expand Down
2 changes: 1 addition & 1 deletion docs/localflavor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ CASocialInsuranceNumberField
----------------------------

A form field that validates input as a Canadian Social Insurance Number (SIN).
A valid number must have the format XXX-XXX-XXXX and pass a `Luhn mod-10
A valid number must have the format XXX-XXX-XXX and pass a `Luhn mod-10
checksum`_.

.. _Luhn mod-10 checksum: http://en.wikipedia.org/wiki/Luhn_algorithm
Expand Down
6 changes: 3 additions & 3 deletions tests/regressiontests/forms/localflavor/ca.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,13 @@
>>> f.clean('046-454-287')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Canadian Social Insurance number in XXX-XXX-XXXX format.']
ValidationError: [u'Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.']
>>> f.clean('046 454 286')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Canadian Social Insurance number in XXX-XXX-XXXX format.']
ValidationError: [u'Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.']
>>> f.clean('046-44-286')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Canadian Social Insurance number in XXX-XXX-XXXX format.']
ValidationError: [u'Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.']
"""

0 comments on commit f633673

Please sign in to comment.