283 Preferences.setUI("ProxyUser/Ftp", username) |
283 Preferences.setUI("ProxyUser/Ftp", username) |
284 Preferences.setUI("ProxyPassword/Ftp", password) |
284 Preferences.setUI("ProxyPassword/Ftp", password) |
285 self.__ftp.setProxyAuthentication(username, password) |
285 self.__ftp.setProxyAuthentication(username, password) |
286 return False, True |
286 return False, True |
287 return False, False |
287 return False, False |
288 except ftplib.error_perm as err: |
288 except (ftplib.error_perm, ftplib.error_temp) as err: |
289 code = err.args[0].strip()[:3] |
289 code = err.args[0].strip()[:3] |
290 if code in ["530", "421"]: |
290 if code in ["530", "421"]: |
291 # error 530 -> Login incorrect |
291 # error 530 -> Login incorrect |
292 # error 421 -> Login may be incorrect (reported by some proxies) |
292 # error 421 -> Login may be incorrect (reported by some proxies) |
293 if byAuth: |
293 if byAuth: |
295 auth = None |
295 auth = None |
296 else: |
296 else: |
297 auth = self.__handler.getAuthenticator(self.url().host()) |
297 auth = self.__handler.getAuthenticator(self.url().host()) |
298 if not auth or auth.isNull() or not auth.user(): |
298 if not auth or auth.isNull() or not auth.user(): |
299 auth = QAuthenticator() |
299 auth = QAuthenticator() |
300 auth.setOption("realm", self.url().host()) |
|
301 self.__manager.authenticationRequired.emit(self, auth) |
300 self.__manager.authenticationRequired.emit(self, auth) |
302 if not auth.isNull(): |
301 if not auth.isNull(): |
303 if auth.user(): |
302 if auth.user(): |
304 self.__handler.setAuthenticator(self.url().host(), auth) |
303 self.__handler.setAuthenticator(self.url().host(), auth) |
305 return False, True |
304 return False, True |