diff -r fb0ef164f536 -r 698ae46f40a4 eric6/WebBrowser/Network/QtHelpSchemeHandler.py --- a/eric6/WebBrowser/Network/QtHelpSchemeHandler.py Fri Apr 02 11:59:41 2021 +0200 +++ b/eric6/WebBrowser/Network/QtHelpSchemeHandler.py Sat May 01 14:27:20 2021 +0200 @@ -67,7 +67,7 @@ @param parent reference to the parent object @type QObject """ - super(QtHelpSchemeHandler, self).__init__(parent) + super().__init__(parent) self.__engine = engine @@ -119,7 +119,7 @@ @param parent reference to the parent object @type QObject """ - super(QtHelpSchemeReply, self).__init__(parent) + super().__init__(parent) self.__job = job self.__engine = engine @@ -136,13 +136,15 @@ # One possible problem might be that the css is loaded at the same # level as the html, thus a path inside the css like # (../images/foo.png) might cd out of the virtual folder - if not self.__engine.findFile(url).isValid(): - if strUrl.startswith(QtDocPath): - newUrl = self.__job.requestUrl() - if not newUrl.path().startswith("/qdoc/"): - newUrl.setPath("/qdoc" + newUrl.path()) - url = newUrl - strUrl = url.toString() + if ( + not self.__engine.findFile(url).isValid() and + strUrl.startswith(QtDocPath) + ): + newUrl = self.__job.requestUrl() + if not newUrl.path().startswith("/qdoc/"): + newUrl.setPath("/qdoc" + newUrl.path()) + url = newUrl + strUrl = url.toString() self.__mimeType = mimetypes.guess_type(strUrl)[0] if self.__mimeType is None: @@ -158,10 +160,10 @@ @param url URL of the requested page @type QUrl """ - if self.__engine.findFile(url).isValid(): - data = self.__engine.fileData(url) - else: - data = QByteArray(self.tr( + data = ( + self.__engine.fileData(url) + if self.__engine.findFile(url).isValid() else + QByteArray(self.tr( """<html>""" """<head><title>Error 404...</title></head>""" """<body><div align="center"><br><br>""" @@ -169,6 +171,7 @@ """<h3>'{0}'</h3></div></body>""" """</html>""").format(url.toString()) .encode("utf-8")) + ) with E5MutexLocker(self.__mutex): self.__buffer.setData(data) @@ -201,7 +204,7 @@ """ Public method used to cloase the reply. """ - super(QtHelpSchemeReply, self).close() + super().close() self.closed.emit() def __mimeFromUrl(self, url):