def clean(self, value):
        super(CAPhoneNumberField, self).clean(value)
        if value in EMPTY_VALUES:
            return u''
        value = re.sub('(\(|\)|\s+)', '', smart_unicode(value))
        m = phone_digits_re.search(value)
        if m:
            return u'%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
        raise ValidationError(self.error_messages['invalid'])
Validate a phone number.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/contrib/localflavor/ca/forms.py/CAPhoneNumberField.clean