Title: [commits] (vajda) [15317] - improved fix for bug 9920 (r=grant)
Revision
15317
Author
vajda
Date
2007-09-11 16:54:11 -0700 (Tue, 11 Sep 2007)

Log Message

- improved fix for bug 9920 (r=grant)
(http://bugzilla.osafoundation.org/show_bug.cgi?id=9920)
(AttributeError: 'pem' while syncing with https://hub.chandlerproject.org)

Modified Paths

Diff

Modified: trunk/chandler/parcels/osaf/framework/certstore/ssl.py (15316 => 15317)

--- trunk/chandler/parcels/osaf/framework/certstore/ssl.py	2007-09-11 06:38:57 UTC (rev 15316)
+++ trunk/chandler/parcels/osaf/framework/certstore/ssl.py	2007-09-11 23:54:11 UTC (rev 15317)
@@ -56,6 +56,7 @@
 from osaf.framework.certstore import constants, utils
 from osaf import messages
 from repository.persistence.RepositoryError import MergeError
+from repository.persistence.RepositoryView import otherViewWins
 
 
 __all__ = ['loadCertificatesToContext', 'SSLContextError', 'getContext',
@@ -89,17 +90,10 @@
             if view.name == 'SSL':
                 return view
         
-        return repo.createView('SSL', pruneSize=400)
+        return repo.createView('SSL', pruneSize=400, notify=False,
+                               mergeFn=otherViewWins)
 
 
-def _mergeCallback(code, item, attribute, value):
-    # 'value' is the one from *this* view
-    # getattr(item, attribute) is the value from a different view
-    if code == MergeError.DELETE:
-        return True
-    return getattr(item, attribute) # Change from *other* view wins
-
-
 def loadCertificatesToContext(repView, ctx):
     """
     Add certificates to SSL Context.
@@ -114,7 +108,7 @@
         for x509 in certificateCache:
             store.add_x509(x509)
         else:
-            sslView.refresh(_mergeCallback)
+            sslView.refresh()
             q = schema.ns('osaf.framework.certstore', sslView).sslCertificateQuery
             for cert in q:
                 x509 = cert.asX509()
@@ -281,7 +275,7 @@
                         return 1
         
                     # Check permanently trusted certificates
-                    self.repositoryView.refresh(_mergeCallback)
+                    self.repositoryView.refresh()
                     q = schema.ns('osaf.framework.certstore', 
                                   self.repositoryView).sslTrustedServerCertificatesQuery
                     for cert in q:




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to