[Commits] (donn) Added a fix for a problem reading mail causing EmailAddress items to be stale

commits at osafoundation.org commits at osafoundation.org
Sat Sep 11 18:59:16 PDT 2004


Commit by: donn
Modified files:
chandler/parcels/osaf/contentmodel/mail/Mail.py 1.27 1.28
chandler/parcels/osaf/mail/message.py 1.19 1.20

Log message:
Added a fix for a problem reading mail causing EmailAddress items to be stale

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/mail/Mail.py.diff?r1=text&tr1=1.27&r2=text&tr2=1.28
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/mail/message.py.diff?r1=text&tr1=1.19&r2=text&tr2=1.20

Index: chandler/parcels/osaf/contentmodel/mail/Mail.py
diff -u chandler/parcels/osaf/contentmodel/mail/Mail.py:1.27 chandler/parcels/osaf/contentmodel/mail/Mail.py:1.28
--- chandler/parcels/osaf/contentmodel/mail/Mail.py:1.27	Fri Sep 10 16:24:09 2004
+++ chandler/parcels/osaf/contentmodel/mail/Mail.py	Sat Sep 11 18:59:15 2004
@@ -1,8 +1,8 @@
 """ Classes used for Mail parcel kinds
 """
 
-__revision__  = "$Revision: 1.27 $"
-__date__      = "$Date: 2004/09/10 23:24:09 $"
+__revision__  = "$Revision: 1.28 $"
+__date__      = "$Date: 2004/09/12 01:59:15 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -512,14 +512,16 @@
         This code needs to be reworked!
         """
         
-    def getEmailAddress (cls, nameOrAddressString, fullName=''):
+    def getEmailAddress (cls, nameOrAddressString, fullName='', updateExisting=True):
         """
           Lookup or create an EmailAddress based
         on the supplied string.
         @param nameOrAddressString: emailAddress string, or fullName for lookup
         @type nameOrAddressString: C{String}
-        @param fullName: the fullName to use when a new item is created
+        @param fullName: explict fullName to use when a new item is created
         @type fullName: C{String}
+        @param updateExisting: if it's OK to update an existing entry
+        @type updateExisting: C{Boolean}
         @return: C{EmailAddress} or None if not found, and nameOrAddressString is\
                not a valid email address.
         """
@@ -577,7 +579,7 @@
             if isValidAddress:
                 if message.emailAddressesAreEqual(candidate.emailAddress, address):
                     # found an existing address!
-                    if fullName != '':
+                    if updateExisting and fullName != '':
                         # update the fullname with what the caller supplied.
                         candidate.fullName = fullName
                     return candidate

Index: chandler/parcels/osaf/mail/message.py
diff -u chandler/parcels/osaf/mail/message.py:1.19 chandler/parcels/osaf/mail/message.py:1.20
--- chandler/parcels/osaf/mail/message.py:1.19	Mon Aug 30 19:42:56 2004
+++ chandler/parcels/osaf/mail/message.py	Sat Sep 11 18:59:15 2004
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.19 $"
-__date__      = "$Date: 2004/08/31 02:42:56 $"
+__revision__  = "$Revision: 1.20 $"
+__date__      = "$Date: 2004/09/12 01:59:15 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -391,7 +391,11 @@
             if hasValue(addr[0]):
                 keyArgs['fullName'] = addr[0]
 
-            ea = Mail.EmailAddress.getEmailAddress(addr[1], **keyArgs)
+            # Use any existing EmailAddress, but don't update them
+            #  because that will cause the item to go stale in the UI thread.
+            ea = Mail.EmailAddress.getEmailAddress(addr[1], 
+                                                   updateExisting=False,
+                                                   **keyArgs)
 
             setattr(kindVar, attr, ea)
 
@@ -402,7 +406,11 @@
                 if hasValue(addr[0]):
                     keyArgs['fullName'] = addr[0]
 
-                ea = Mail.EmailAddress.getEmailAddress(addr[1], **keyArgs)
+                # Use any existing EmailAddress, but don't update them
+                #  because that will cause the item to go stale in the UI thread.
+                ea = Mail.EmailAddress.getEmailAddress(addr[1], 
+                                                       updateExisting=False,
+                                                       **keyArgs)
                 kindVar.append(ea)
     else:
         logging.error("in osaf.mail.message.__assignToKind: HEADER SLIPPED THROUGH")



More information about the Commits mailing list