Helpviewer/Passwords/PasswordManager.py

changeset 5736
000ea446ff4b
parent 5597
3d88d53f8c2b
child 6048
82ad8ec9548c
equal deleted inserted replaced
5735:f606dbe20be6 5736:000ea446ff4b
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 import os 12 import os
13 13
14 from PyQt5.QtCore import pyqtSignal, QObject, QByteArray, QUrl, \ 14 from PyQt5.QtCore import pyqtSignal, QObject, QByteArray, QUrl, \
15 QCoreApplication, QXmlStreamReader, qVersion 15 QCoreApplication, QXmlStreamReader
16 from PyQt5.QtWidgets import QApplication 16 from PyQt5.QtWidgets import QApplication
17 from PyQt5.QtNetwork import QNetworkRequest 17 from PyQt5.QtNetwork import QNetworkRequest
18 from PyQt5.QtWebKit import QWebSettings 18 from PyQt5.QtWebKit import QWebSettings
19 from PyQt5.QtWebKitWidgets import QWebPage 19 from PyQt5.QtWebKitWidgets import QWebPage
20 20
23 23
24 from Utilities.AutoSaver import AutoSaver 24 from Utilities.AutoSaver import AutoSaver
25 import Utilities 25 import Utilities
26 import Utilities.crypto 26 import Utilities.crypto
27 import Preferences 27 import Preferences
28 from Globals import qVersionTuple
28 29
29 30
30 class PasswordManager(QObject): 31 class PasswordManager(QObject):
31 """ 32 """
32 Class implementing the password manager. 33 Class implementing the password manager.
435 436
436 @param url URL to be stripped (QUrl) 437 @param url URL to be stripped (QUrl)
437 @return stripped URL (QUrl) 438 @return stripped URL (QUrl)
438 """ 439 """
439 cleanUrl = QUrl(url) 440 cleanUrl = QUrl(url)
440 if qVersion() >= "5.0.0": 441 if qVersionTuple() >= (5, 0, 0):
441 cleanUrl.setQuery("") 442 cleanUrl.setQuery("")
442 else: 443 else:
443 cleanUrl.setQueryItems([]) 444 cleanUrl.setQueryItems([])
444 cleanUrl.setUserInfo("") 445 cleanUrl.setUserInfo("")
445 446
464 from .LoginForm import LoginForm 465 from .LoginForm import LoginForm
465 form = LoginForm() 466 form = LoginForm()
466 if boundary is not None: 467 if boundary is not None:
467 args = self.__extractMultipartQueryItems(data, boundary) 468 args = self.__extractMultipartQueryItems(data, boundary)
468 else: 469 else:
469 if qVersion() >= "5.0.0": 470 if qVersionTuple() >= (5, 0, 0):
470 from PyQt5.QtCore import QUrlQuery 471 from PyQt5.QtCore import QUrlQuery
471 argsUrl = QUrl.fromEncoded( 472 argsUrl = QUrl.fromEncoded(
472 QByteArray(b"foo://bar.com/?" + QUrl.fromPercentEncoding( 473 QByteArray(b"foo://bar.com/?" + QUrl.fromPercentEncoding(
473 data.replace(b"+", b"%20")).encode("utf-8"))) 474 data.replace(b"+", b"%20")).encode("utf-8")))
474 encodedArgs = QUrlQuery(argsUrl).queryItems() 475 encodedArgs = QUrlQuery(argsUrl).queryItems()

eric ide

mercurial