[Commits] (bkirsch) Added email address validation

commits at osafoundation.org commits at osafoundation.org
Thu Aug 12 16:56:15 PDT 2004


Commit by: bkirsch
Modified files:
chandler/parcels/osaf/framework/blocks/detail/Detail.py 1.21 1.22

Log message:
Added email address validation

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/detail/Detail.py.diff?r1=text&tr1=1.21&r2=text&tr2=1.22

Index: chandler/parcels/osaf/framework/blocks/detail/Detail.py
diff -u chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.21 chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.22
--- chandler/parcels/osaf/framework/blocks/detail/Detail.py:1.21	Wed Aug 11 06:33:13 2004
+++ chandler/parcels/osaf/framework/blocks/detail/Detail.py	Thu Aug 12 16:56:14 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.21 $"
-__date__ = "$Date: 2004/08/11 13:33:13 $"
+__version__ = "$Revision: 1.22 $"
+__date__ = "$Date: 2004/08/12 23:56:14 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -13,6 +13,7 @@
 import osaf.contentmodel.tasks.Task as Task
 import osaf.contentmodel.calendar.Calendar as Calendar
 import repository.item.Query as Query
+import osaf.mail.message as message
 import wx
 
 """
@@ -398,11 +399,16 @@
 
         # for each address, strip white space, and match with existing
         addressList = []
+
+        #List of strings containing invalid email addresses
+        badAddressList = []
+
         for address in addresses:
-            address.strip()
-            if '.' in address and '@' in address:
+            address = address.strip()
+
+            if message.isValidEmailAddress(address):
                 for candidate in knownAddresses:
-                    if candidate.emailAddress == address:
+                    if message.emailAddressesAreEqual(candidate.emailAddress, address):
                         # found an existing address!
                         addressList.append(candidate)
                         break
@@ -411,6 +417,13 @@
                     newAddress = Mail.EmailAddress()
                     newAddress.emailAddress = address
                     addressList.append(newAddress)
+            else:
+                badAddressList.append(address)
+
+        ##Pop-up Error Dialog about bad address
+        if len(badAddressList) > 0:
+            pass
+            #print "The following addresses are invalid: ", ", ".join(badAddressList)
 
         # reassign the list to the attribute
         item.who = addressList



More information about the Commits mailing list