E5Network/E5SslErrorHandler.py

changeset 2360
b6bf3925e3e1
parent 2354
c63de4af553d
child 2525
8b507a9a2d40
child 2990
583beaf0b4b8
--- a/E5Network/E5SslErrorHandler.py	Fri Jan 18 19:50:13 2013 +0100
+++ b/E5Network/E5SslErrorHandler.py	Sat Jan 19 16:59:23 2013 +0100
@@ -24,6 +24,10 @@
     It also initializes the default SSL configuration with certificates
     permanently accepted by the user already.
     """
+    NotIgnored = 0
+    SystemIgnored = 1
+    UserIgnored = 2
+    
     def __init__(self, parent=None):
         """
         Constructor
@@ -71,8 +75,9 @@
         
         @param reply reference to the reply object (QNetworkReply)
         @param errors list of SSL errors (list of QSslError)
-        @return tuple of two flags indicating to ignore the SSL errors (boolean)
-            and indicating a change of the default SSL configuration (boolean)
+        @return tuple indicating to ignore the SSL errors (one of NotIgnored,
+            SystemIgnored or UserIgnored) and indicating a change of the default
+            SSL configuration (boolean)
         """
         url = reply.url()
         ignore, defaultChanged = self.sslErrors(errors, url.host(), url.port())
@@ -92,8 +97,9 @@
         @param errors list of SSL errors (list of QSslError)
         @param server name of the server (string)
         @keyparam port value of the port (integer)
-        @return tuple of two flags indicating to ignore the SSL errors (boolean)
-            and indicating a change of the default SSL configuration (boolean)
+        @return tuple indicating to ignore the SSL errors (one of NotIgnored,
+            SystemIgnored or UserIgnored) and indicating a change of the default
+            SSL configuration (boolean)
         """
         caMerge = {}
         certificateDict = Preferences.toDict(
@@ -117,7 +123,7 @@
                     if cert not in caNew:
                         caNew.append(cert)
         if not errorStrings:
-            return True, False
+            return E5SslErrorHandler.SystemIgnored, False
         
         errorString = '.</li><li>'.join(errorStrings)
         ret = E5MessageBox.yesNo(None,
@@ -162,10 +168,10 @@
                     Preferences.Prefs.settings.setValue("Ssl/CaCertificatesDict",
                         certificateDict)
             
-            return True, caRet
+            return E5SslErrorHandler.UserIgnored, caRet
         
         else:
-            return False, False
+            return E5SslErrorHandler.NotIgnored, False
     
     def __certToString(self, cert):
         """

eric ide

mercurial