Changeset 5099
- Timestamp:
- 04/26/07 10:05:47 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/contrib/localflavor/br/forms.py
r5089 r5099 32 32 class BRStateSelect(Select): 33 33 """ 34 A Select widget that uses a list of brazilian states/territories34 A Select widget that uses a list of Brazilian states/territories 35 35 as its choices. 36 36 """ … … 48 48 """ 49 49 This field validate a CPF number or a CPF string. A CPF number is 50 compounded by XXX.XXX.XXX-VD , the two last digits are check digits.50 compounded by XXX.XXX.XXX-VD. The two last digits are check digits. 51 51 52 52 More information: … … 70 70 int(value) 71 71 except ValueError: 72 raise ValidationError(gettext("This field requires only numbers "))72 raise ValidationError(gettext("This field requires only numbers.")) 73 73 if len(value) != 11: 74 74 raise ValidationError(gettext("This field requires at most 11 digits or 14 characters.")) … … 101 101 int(value) 102 102 except ValueError: 103 raise ValidationError("This field requires only numbers ")103 raise ValidationError("This field requires only numbers.") 104 104 if len(value) != 14: 105 105 raise ValidationError( … … 114 114 value = value[:-1] + str(new_2dv) 115 115 if value[-2:] != orig_dv: 116 raise ValidationError(gettext("Invalid CNPJ number "))116 raise ValidationError(gettext("Invalid CNPJ number.")) 117 117 118 118 return orig_value django/trunk/tests/regressiontests/forms/localflavor.py
r5089 r5099 852 852 Traceback (most recent call last): 853 853 ... 854 ValidationError: [u'Invalid CNPJ number ']854 ValidationError: [u'Invalid CNPJ number.'] 855 855 >>> f.clean('12.345.678/9012-10') 856 856 Traceback (most recent call last): 857 857 ... 858 ValidationError: [u'Invalid CNPJ number ']858 ValidationError: [u'Invalid CNPJ number.'] 859 859 >>> f.clean('12345678/9012-10') 860 860 Traceback (most recent call last): 861 861 ... 862 ValidationError: [u'Invalid CNPJ number ']862 ValidationError: [u'Invalid CNPJ number.'] 863 863 >>> f.clean('64.132.916/0001-88') 864 864 '64.132.916/0001-88' … … 870 870 Traceback (most recent call last): 871 871 ... 872 ValidationError: [u'This field requires only numbers ']872 ValidationError: [u'This field requires only numbers.'] 873 873 >>> f = BRCNPJField(required=False) 874 874 >>> f.clean('')
