Helpviewer/Network/FtpAccessHandler.py

changeset 2050
585f6646bf50
parent 1509
c0b5e693b0eb
child 2302
f29e9405c851
equal deleted inserted replaced
2048:da2d82f84924 2050:585f6646bf50
15 15
16 class FtpAccessHandler(SchemeAccessHandler): 16 class FtpAccessHandler(SchemeAccessHandler):
17 """ 17 """
18 Class implementing a scheme access handler for FTP. 18 Class implementing a scheme access handler for FTP.
19 """ 19 """
20 def __init__(self, parent=None):
21 """
22 Constructor
23
24 @param parent reference to the parent object (QObject)
25 """
26 super().__init__(parent)
27
28 self.__authenticatorCache = {}
29 self.__proxyAuthenticator = None
30
20 def createRequest(self, op, request, outgoingData=None): 31 def createRequest(self, op, request, outgoingData=None):
21 """ 32 """
22 Protected method to create a request. 33 Protected method to create a request.
23 34
24 @param op the operation to be performed (QNetworkAccessManager.Operation) 35 @param op the operation to be performed (QNetworkAccessManager.Operation)
26 @param outgoingData reference to an IODevice containing data to be sent 37 @param outgoingData reference to an IODevice containing data to be sent
27 (QIODevice) 38 (QIODevice)
28 @return reference to the created reply object (QNetworkReply) 39 @return reference to the created reply object (QNetworkReply)
29 """ 40 """
30 if op == QNetworkAccessManager.GetOperation: 41 if op == QNetworkAccessManager.GetOperation:
31 return FtpReply(request.url(), self.parent()) 42 return FtpReply(request.url(), self, self.parent())
32 else: 43 else:
33 return None 44 return None
45
46 def setAuthenticator(self, realm, authenticator):
47 """
48 Public method to add or change an authenticator in our cache.
49
50 @param realm name of the realm the authenticator belongs to (string)
51 @param authenticator authenticator to add to the cache (QAuthenticator).
52 If it is None, the entry will be deleted from the cache.
53 """
54 if realm:
55 if authenticator:
56 self.__authenticatorCache[realm] = authenticator
57 else:
58 if realm in self.__authenticatorCache:
59 del self.__authenticatorCache[realm]
60
61 def getAuthenticator(self, realm):
62 """
63 Public method to get an authenticator for the given realm.
64
65 @param realm name of the realm to get the authenticator for (string)
66 @return authenticator for the given realm (QAuthenticator) or None
67 """
68 if realm in self.__authenticatorCache:
69 return self.__authenticatorCache[realm]
70 else:
71 return None
72
73 def setProxyAuthenticator(self, authenticator):
74 """
75 Public method to add or change the authenticator for the FTP proxy.
76
77 @param authenticator authenticator for the FTP proxy (QAuthenticator)
78 """
79 self.__proxyAuthenticator = authenticator
80
81 def getProxyAuthenticator(self):
82 """
83 Public method to get the authenticator for the FTP proxy.
84
85 @return authenticator for the FTP proxy (QAuthenticator)
86 """
87 return self.__proxyAuthenticator

eric ide

mercurial