#NEWLINE# def clean( self , value ) : #NEWLINE# #INDENT# 'Validate a phone number.\n        ' #NEWLINE# super ( CAPhoneNumberField , self ) . clean ( self ) #NEWLINE# if ( value in EMPTY_VALUES ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# value = re . sub ( '(\\(|\\)|\\s+)' , '' , smart_text ( value ) ) #NEWLINE# m = phone_digits_re . search ( value ) #NEWLINE# if m : #NEWLINE# #INDENT# return ( '%s-%s-%s' % ( m . group ( 1 ) , m . group ( 2 ) , m . group ( 3 ) ) ) #NEWLINE# #UNINDENT# raise ValidationError ( self . error_messages [ 'invalid' ] )