Fixed inconsistent period usage in localflavor.br error messages from [5089]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5099 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-04-26 15:05:47 +00:00
parent 143270856b
commit 51e867a2e5
2 changed files with 9 additions and 9 deletions

View File

@ -31,7 +31,7 @@ class BRPhoneNumberField(Field):
class BRStateSelect(Select): class BRStateSelect(Select):
""" """
A Select widget that uses a list of brazilian states/territories A Select widget that uses a list of Brazilian states/territories
as its choices. as its choices.
""" """
def __init__(self, attrs=None): def __init__(self, attrs=None):
@ -47,7 +47,7 @@ def DV_maker(v):
class BRCPFField(CharField): class BRCPFField(CharField):
""" """
This field validate a CPF number or a CPF string. A CPF number is This field validate a CPF number or a CPF string. A CPF number is
compounded by XXX.XXX.XXX-VD, the two last digits are check digits. compounded by XXX.XXX.XXX-VD. The two last digits are check digits.
More information: More information:
http://en.wikipedia.org/wiki/Cadastro_de_Pessoas_F%C3%ADsicas http://en.wikipedia.org/wiki/Cadastro_de_Pessoas_F%C3%ADsicas
@ -69,7 +69,7 @@ class BRCPFField(CharField):
try: try:
int(value) int(value)
except ValueError: except ValueError:
raise ValidationError(gettext("This field requires only numbers")) raise ValidationError(gettext("This field requires only numbers."))
if len(value) != 11: if len(value) != 11:
raise ValidationError(gettext("This field requires at most 11 digits or 14 characters.")) raise ValidationError(gettext("This field requires at most 11 digits or 14 characters."))
orig_dv = value[-2:] orig_dv = value[-2:]
@ -100,7 +100,7 @@ class BRCNPJField(Field):
try: try:
int(value) int(value)
except ValueError: except ValueError:
raise ValidationError("This field requires only numbers") raise ValidationError("This field requires only numbers.")
if len(value) != 14: if len(value) != 14:
raise ValidationError( raise ValidationError(
gettext("This field requires at least 14 digits")) gettext("This field requires at least 14 digits"))
@ -113,7 +113,7 @@ class BRCNPJField(Field):
new_2dv = DV_maker(new_2dv % 11) new_2dv = DV_maker(new_2dv % 11)
value = value[:-1] + str(new_2dv) value = value[:-1] + str(new_2dv)
if value[-2:] != orig_dv: if value[-2:] != orig_dv:
raise ValidationError(gettext("Invalid CNPJ number")) raise ValidationError(gettext("Invalid CNPJ number."))
return orig_value return orig_value

View File

@ -851,15 +851,15 @@ ValidationError: [u'This field is required.']
>>> f.clean('12-345-678/9012-10') >>> f.clean('12-345-678/9012-10')
Traceback (most recent call last): Traceback (most recent call last):
... ...
ValidationError: [u'Invalid CNPJ number'] ValidationError: [u'Invalid CNPJ number.']
>>> f.clean('12.345.678/9012-10') >>> f.clean('12.345.678/9012-10')
Traceback (most recent call last): Traceback (most recent call last):
... ...
ValidationError: [u'Invalid CNPJ number'] ValidationError: [u'Invalid CNPJ number.']
>>> f.clean('12345678/9012-10') >>> f.clean('12345678/9012-10')
Traceback (most recent call last): Traceback (most recent call last):
... ...
ValidationError: [u'Invalid CNPJ number'] ValidationError: [u'Invalid CNPJ number.']
>>> f.clean('64.132.916/0001-88') >>> f.clean('64.132.916/0001-88')
'64.132.916/0001-88' '64.132.916/0001-88'
>>> f.clean('64-132-916/0001-88') >>> f.clean('64-132-916/0001-88')
@ -869,7 +869,7 @@ ValidationError: [u'Invalid CNPJ number']
>>> f.clean('64.132.916/0001-XX') >>> f.clean('64.132.916/0001-XX')
Traceback (most recent call last): Traceback (most recent call last):
... ...
ValidationError: [u'This field requires only numbers'] ValidationError: [u'This field requires only numbers.']
>>> f = BRCNPJField(required=False) >>> f = BRCNPJField(required=False)
>>> f.clean('') >>> f.clean('')
u'' u''