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() scheme = req.url().scheme()
if scheme == 'https' and not SSL_AVAILABLE: if scheme == 'https' and not SSL_AVAILABLE:
return ErrorNetworkReply( return ErrorNetworkReply(
"SSL is not supported by the installed Qt library!", req, "SSL is not supported by the installed Qt library!",
QNetworkReply.ProtocolUnknownError) QNetworkReply.ProtocolUnknownError)
elif scheme in self._scheme_handlers: elif scheme in self._scheme_handlers:
return self._scheme_handlers[scheme].createRequest( return self._scheme_handlers[scheme].createRequest(

View File

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