def validate_email(s, quiet=True): try: _validate_email(s) return True except Exception, e: if not quiet: raise e
def validate_email(s, quiet=True): try: _validate_email(s) return is_valid_domain(s) except Exception as e: if not quiet: raise e return False
def validate_email(email, user=None): """Require unique email address""" try: _validate_email(email) except ValidationError: raise ValidationError('You must enter a valid email address', code='email_invalid') try: User.objects.get(Q(username=email) | Q(email=email)) raise ValidationError('A user with this email address already exists', code='email_duplicate') except User.DoesNotExist: pass try: UserEmail.objects.get(email=email) raise ValidationError('A user with this email address already exists', code='email_duplicate') except UserEmail.DoesNotExist: pass
def validate_email(email): try: _validate_email(email) return True except ValidationError: return False