Skip to content

Commit

Permalink
modulo para validacao de e-mail
Browse files Browse the repository at this point in the history
  • Loading branch information
ramalho committed Dec 31, 2011
1 parent 4d501bb commit a4c8a0b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions atributos/email.py
@@ -1,14 +1,14 @@

"""
E-mail validation regex copied from Django 1.3.1
E-mail validation regex from Django 1.3.1:
http://code.djangoproject.com/svn/django/branches/releases/1.3.X/django/core/validators.py
>>> validar_email('luciano@ramalho.org')
>>> is_valid('luciano@ramalho.org')
True
>>> validar_email('a@b.cd')
>>> is_valid('a@b.cd')
True
>>> validar_email('x')
>>> is_valid('x')
False
"""
Expand All @@ -20,5 +20,5 @@
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string
r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE) # domain

def validar_email(email):
def is_valid(email):
return bool(email_re.match(email))

0 comments on commit a4c8a0b

Please sign in to comment.