E5Network/E5SslCertificatesInfoWidget.py

changeset 5736
000ea446ff4b
parent 5624
cdd346d8858b
child 6048
82ad8ec9548c
--- a/E5Network/E5SslCertificatesInfoWidget.py	Sat May 13 13:46:05 2017 +0200
+++ b/E5Network/E5SslCertificatesInfoWidget.py	Sat May 13 16:32:54 2017 +0200
@@ -13,13 +13,14 @@
 except NameError:
     pass
 
-from PyQt5.QtCore import pyqtSlot, QCryptographicHash, QDateTime, qVersion
+from PyQt5.QtCore import pyqtSlot, QCryptographicHash, QDateTime
 from PyQt5.QtWidgets import QWidget
 from PyQt5.QtNetwork import QSslCertificate
 
 from .Ui_E5SslCertificatesInfoWidget import Ui_E5SslCertificatesInfoWidget
 
 import Utilities
+from Globals import qVersionTuple
 
 
 class E5SslCertificatesInfoWidget(QWidget, Ui_E5SslCertificatesInfoWidget):
@@ -51,12 +52,12 @@
         self.__chain = certificateChain[:]
         
         for cert in self.__chain:
-            if qVersion() >= "5.0.0":
+            if qVersionTuple() >= (5, 0, 0):
                 name = ", ".join(cert.subjectInfo(QSslCertificate.CommonName))
             else:
                 name = cert.subjectInfo(QSslCertificate.CommonName)
             if not name:
-                if qVersion() >= "5.0.0":
+                if qVersionTuple() >= (5, 0, 0):
                     name = ", ".join(
                         cert.subjectInfo(QSslCertificate.Organization))
                 else:
@@ -94,7 +95,7 @@
         self.expiredLabel.setStyleSheet(
             "QLabel { color : white; background-color : red; }")
         
-        if qVersion() >= "5.0.0":
+        if qVersionTuple() >= (5, 0, 0):
             self.subjectCommonNameLabel.setText(self.__certificateString(
                 ", ".join(certificate.subjectInfo(
                     QSslCertificate.CommonName))))
@@ -141,8 +142,8 @@
             str(certificate.digest(QCryptographicHash.Md5).toHex(),
                 encoding="ascii")))
         
-        if (qVersion() >= "5.0.0" and certificate.isBlacklisted()) or \
-           (qVersion() < "5.0.0" and not certificate.isValid()):
+        if (qVersionTuple() >= (5, 0, 0) and certificate.isBlacklisted()) or \
+           (qVersionTuple() < (5, 0, 0) and not certificate.isValid()):
             # something is wrong; indicate it to the user
             if self.__hasExpired(certificate.effectiveDate(),
                                  certificate.expiryDate()):

eric ide

mercurial