both hostnames and mail addresses should composed by lowercase letters
[plcapi.git] / PLC / Persons.py
index 8aa638e..d35f9f7 100644 (file)
@@ -78,13 +78,13 @@ class Person(Row):
         """
         Validate email address. Stolen from Mailman.
         """
-
+        email = email.lower()
         invalid_email = PLCInvalidArgument("Invalid e-mail address")
 
         if not email:
             raise invalid_email
 
-        email_re = re.compile('[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-_]+\.[a-zA-Z]+')
+       email_re = re.compile('\A[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9._\-]+\.[a-zA-Z]+\Z')
         if not email_re.match(email):
             raise invalid_email