Negligible formatting changes to some recent commits

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4917 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-04-03 22:33:28 +00:00
parent 87471549b3
commit f791a598a8
3 changed files with 6 additions and 8 deletions

View File

@ -43,13 +43,12 @@ class USSocialSecurityNumberField(Field):
* The number is not one known to be invalid due to otherwise widespread * The number is not one known to be invalid due to otherwise widespread
promotional use or distribution (e.g., the Woolworth's number or the 1962 promotional use or distribution (e.g., the Woolworth's number or the 1962
promotional number). promotional number).
""" """
def clean(self, value): def clean(self, value):
super(USSocialSecurityNumberField, self).clean(value) super(USSocialSecurityNumberField, self).clean(value)
if value in EMPTY_VALUES: if value in EMPTY_VALUES:
return u'' return u''
msg = gettext(u'Enter a valid US Social Security number in XXX-XX-XXXX format') msg = gettext(u'Enter a valid U.S. Social Security number in XXX-XX-XXXX format.')
match = re.match(ssn_re, value) match = re.match(ssn_re, value)
if not match: if not match:
raise ValidationError(msg) raise ValidationError(msg)
@ -63,8 +62,7 @@ class USSocialSecurityNumberField(Field):
# Second pass: promotional and otherwise permanently invalid numbers. # Second pass: promotional and otherwise permanently invalid numbers.
if area == '666' or \ if area == '666' or \
(area == '987' and group == '65' and \ (area == '987' and group == '65' and 4320 <= int(serial) <= 4329) or \
4320 <= int(serial) <= 4329) or \
value == '078-05-1120' or \ value == '078-05-1120' or \
value == '219-09-9999': value == '219-09-9999':
raise ValidationError(msg) raise ValidationError(msg)

View File

@ -30,7 +30,7 @@ root_dir = os.path.dirname(__file__)
django_dir = os.path.join(root_dir, 'django') django_dir = os.path.join(root_dir, 'django')
pieces = fullsplit(root_dir) pieces = fullsplit(root_dir)
if pieces[-1] == '': if pieces[-1] == '':
len_root_dir = len(pieces)- 1 len_root_dir = len(pieces) - 1
else: else:
len_root_dir = len(pieces) len_root_dir = len(pieces)

View File

@ -256,7 +256,7 @@ u'987-65-4330'
>>> f.clean('078-05-1120') >>> f.clean('078-05-1120')
Traceback (most recent call last): Traceback (most recent call last):
... ...
ValidationError: [u'Enter a valid US Social Security number in XXX-XX-XXXX format'] ValidationError: [u'Enter a valid U.S. Social Security number in XXX-XX-XXXX format.']
# UKPostcodeField ############################################################# # UKPostcodeField #############################################################