Set request for ErrorNetworkReply.

This commit is contained in:
Florian Bruhin 2014-06-21 23:04:30 +02:00
parent e8ded0a32a
commit 800fa381b1
2 changed files with 4 additions and 2 deletions

View File

@ -129,7 +129,7 @@ class NetworkManager(QNetworkAccessManager):
scheme = req.url().scheme()
if scheme == 'https' and not SSL_AVAILABLE:
return ErrorNetworkReply(
"SSL is not supported by the installed Qt library!",
req, "SSL is not supported by the installed Qt library!",
QNetworkReply.ProtocolUnknownError)
elif scheme in self._scheme_handlers:
return self._scheme_handlers[scheme].createRequest(

View File

@ -118,15 +118,17 @@ class ErrorNetworkReply(QNetworkReply):
"""QNetworkReply which always returns an error."""
def __init__(self, errorstring, error, parent=None):
def __init__(self, req, errorstring, error, parent=None):
"""Constructor.
Args:
req: The QNetworkRequest associated with this reply.
errorstring: The error string to print.
error: The numerical error value.
parent: The parent to pass to QNetworkReply.
"""
super().__init__(parent)
self.setRequest(req)
self.setError(error, errorstring)
# For some reason, a segfault will be triggered if these lambdas aren't
# there.