Helpviewer/AdBlock/AdBlockBlockedNetworkReply.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3000
971d84f7a6d6
child 3060
5883ce99ee12
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
20 def __init__(self, request, subscription, rule, parent=None): 20 def __init__(self, request, subscription, rule, parent=None):
21 """ 21 """
22 Constructor 22 Constructor
23 23
24 @param request reference to the request object (QNetworkRequest) 24 @param request reference to the request object (QNetworkRequest)
25 @param subscription subscription containing the matched rule (AdBlockSubscription) 25 @param subscription subscription containing the matched rule
26 (AdBlockSubscription)
26 @param rule matching rule (AdBlockRule) 27 @param rule matching rule (AdBlockRule)
27 @param parent reference to the parent object (QObject) 28 @param parent reference to the parent object (QObject)
28 """ 29 """
29 super(AdBlockBlockedNetworkReply, self).__init__(parent) 30 super(AdBlockBlockedNetworkReply, self).__init__(parent)
30 self.setOperation(QNetworkAccessManager.GetOperation) 31 self.setOperation(QNetworkAccessManager.GetOperation)
31 self.setRequest(request) 32 self.setRequest(request)
32 self.setUrl(request.url()) 33 self.setUrl(request.url())
33 self.setError(QNetworkReply.ContentAccessDenied, 34 self.setError(
34 "AdBlockRule:{0} ({1})".format(subscription.title(), rule.filter())) 35 QNetworkReply.ContentAccessDenied,
36 "AdBlockRule:{0} ({1})"
37 .format(subscription.title(), rule.filter()))
35 QTimer.singleShot(0, self.__fireSignals) 38 QTimer.singleShot(0, self.__fireSignals)
36 39
37 def __fireSignals(self): 40 def __fireSignals(self):
38 """ 41 """
39 Private method to send some signals to end the connection. 42 Private method to send some signals to end the connection.
40 """ 43 """
41 self.error[QNetworkReply.NetworkError].emit(QNetworkReply.ContentAccessDenied) 44 self.error[QNetworkReply.NetworkError].emit(
45 QNetworkReply.ContentAccessDenied)
42 self.finished.emit() 46 self.finished.emit()
43 47
44 def readData(self, maxlen): 48 def readData(self, maxlen):
45 """ 49 """
46 Protected method to retrieve data from the reply object. 50 Protected method to retrieve data from the reply object.

eric ide

mercurial