[Commits] (bkirsch) fixed email validation logic

commits at osafoundation.org commits at osafoundation.org
Wed Aug 25 17:28:14 PDT 2004


Commit by: bkirsch
Modified files:
chandler/parcels/osaf/mail/message.py 1.15 1.16

Log message:
fixed email validation logic

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/mail/message.py.diff?r1=text&tr1=1.15&r2=text&tr2=1.16

Index: chandler/parcels/osaf/mail/message.py
diff -u chandler/parcels/osaf/mail/message.py:1.15 chandler/parcels/osaf/mail/message.py:1.16
--- chandler/parcels/osaf/mail/message.py:1.15	Wed Aug 25 12:45:31 2004
+++ chandler/parcels/osaf/mail/message.py	Wed Aug 25 17:28:13 2004
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.15 $"
-__date__      = "$Date: 2004/08/25 19:45:31 $"
+__revision__  = "$Revision: 1.16 $"
+__date__      = "$Date: 2004/08/26 00:28:13 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -13,7 +13,7 @@
 import common as common
 import logging as logging
 
-__exp = re.compile("\w+((-\w+)|(\.\w+)|(\_\w+))*\@[A-Za-z2-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]{2,5}")
+__exp = "\w+((-\w+)|(\.\w+)|(\_\w+))*\@[A-Za-z2-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]{2,5}"
 
 
 def isValidEmailAddress(emailAddress):
@@ -35,9 +35,8 @@
 
     #XXX: Test id the address is in the form John test <john at test.com and handle it>
     #emailAddress = Utils.parseaddr(emailAddress)[1]
-
     if len(emailAddress) > 3:
-        if __exp.match(emailAddress) is not None:
+        if re.match("\w+((-\w+)|(\.\w+)|(\_\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]{2,5}", emailAddress) is not None:
             return True
 
     return False



More information about the Commits mailing list