Helpviewer/SslCertificatesDialog.py

branch
5_3_x
changeset 2356
ece6580f36cc
parent 2302
f29e9405c851
child 2364
e90e9235f7d9
equal deleted inserted replaced
2353:695b47b308c8 2356:ece6580f36cc
67 @param server server name of the certificate (string) 67 @param server server name of the certificate (string)
68 @param cert certificate to insert (QSslCertificate) 68 @param cert certificate to insert (QSslCertificate)
69 """ 69 """
70 # step 1: extract the info to be shown 70 # step 1: extract the info to be shown
71 if qVersion() >= "5.0.0": 71 if qVersion() >= "5.0.0":
72 organisation = Utilities.html_encode(Utilities.decodeString( 72 organisation = Utilities.decodeString(
73 ", ".join(cert.subjectInfo(QSslCertificate.Organization)))) 73 ", ".join(cert.subjectInfo(QSslCertificate.Organization)))
74 commonName = Utilities.html_encode(Utilities.decodeString( 74 commonName = Utilities.decodeString(
75 ", ".join(cert.subjectInfo(QSslCertificate.CommonName)))) 75 ", ".join(cert.subjectInfo(QSslCertificate.CommonName)))
76 else: 76 else:
77 organisation = Utilities.html_encode(Utilities.decodeString( 77 organisation = Utilities.decodeString(
78 cert.subjectInfo(QSslCertificate.Organization))) 78 cert.subjectInfo(QSslCertificate.Organization))
79 commonName = Utilities.html_encode(Utilities.decodeString( 79 commonName = Utilities.decodeString(
80 cert.subjectInfo(QSslCertificate.CommonName))) 80 cert.subjectInfo(QSslCertificate.CommonName))
81 if organisation is None or organisation == "": 81 if organisation is None or organisation == "":
82 organisation = self.trUtf8("(Unknown)") 82 organisation = self.trUtf8("(Unknown)")
83 if commonName is None or commonName == "": 83 if commonName is None or commonName == "":
84 commonName = self.trUtf8("(Unknown common name)") 84 commonName = self.trUtf8("(Unknown common name)")
85 expiryDate = Utilities.html_encode(cert.expiryDate().toString("yyyy-MM-dd")) 85 expiryDate = cert.expiryDate().toString("yyyy-MM-dd")
86 86
87 # step 2: create the entry 87 # step 2: create the entry
88 items = self.serversCertificatesTree.findItems(organisation, 88 items = self.serversCertificatesTree.findItems(organisation,
89 Qt.MatchFixedString | Qt.MatchCaseSensitive) 89 Qt.MatchFixedString | Qt.MatchCaseSensitive)
90 if len(items) == 0: 90 if len(items) == 0:
259 259
260 @param cert certificate to insert (QSslCertificate) 260 @param cert certificate to insert (QSslCertificate)
261 """ 261 """
262 # step 1: extract the info to be shown 262 # step 1: extract the info to be shown
263 if qVersion() >= "5.0.0": 263 if qVersion() >= "5.0.0":
264 organisation = Utilities.html_encode(Utilities.decodeString( 264 organisation = Utilities.decodeString(
265 ", ".join(cert.subjectInfo(QSslCertificate.Organization)))) 265 ", ".join(cert.subjectInfo(QSslCertificate.Organization)))
266 commonName = Utilities.html_encode(Utilities.decodeString( 266 commonName = Utilities.decodeString(
267 ", ".join(cert.subjectInfo(QSslCertificate.CommonName)))) 267 ", ".join(cert.subjectInfo(QSslCertificate.CommonName)))
268 else: 268 else:
269 organisation = Utilities.html_encode(Utilities.decodeString( 269 organisation = Utilities.decodeString(
270 cert.subjectInfo(QSslCertificate.Organization))) 270 cert.subjectInfo(QSslCertificate.Organization))
271 commonName = Utilities.html_encode(Utilities.decodeString( 271 commonName = Utilities.decodeString(
272 cert.subjectInfo(QSslCertificate.CommonName))) 272 cert.subjectInfo(QSslCertificate.CommonName))
273 if organisation is None or organisation == "": 273 if organisation is None or organisation == "":
274 organisation = self.trUtf8("(Unknown)") 274 organisation = self.trUtf8("(Unknown)")
275 if commonName is None or commonName == "": 275 if commonName is None or commonName == "":
276 commonName = self.trUtf8("(Unknown common name)") 276 commonName = self.trUtf8("(Unknown common name)")
277 expiryDate = Utilities.html_encode(cert.expiryDate().toString("yyyy-MM-dd")) 277 expiryDate = cert.expiryDate().toString("yyyy-MM-dd")
278 278
279 # step 2: create the entry 279 # step 2: create the entry
280 items = self.caCertificatesTree.findItems(organisation, 280 items = self.caCertificatesTree.findItems(organisation,
281 Qt.MatchFixedString | Qt.MatchCaseSensitive) 281 Qt.MatchFixedString | Qt.MatchCaseSensitive)
282 if len(items) == 0: 282 if len(items) == 0:

eric ide

mercurial