From: Oleg Broytman Date: Fri, 29 Jul 2016 20:03:02 +0000 (+0300) Subject: Fix py3 compatibility: ftp port must be 0, not None X-Git-Tag: 3.0.0~1 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=7a8555bdaad5e6ed6fd1e9af817b7efc0cb11137;p=m_lib.git Fix py3 compatibility: ftp port must be 0, not None --- diff --git a/m_lib/net/ftp/ftpscan.py b/m_lib/net/ftp/ftpscan.py index 51c92f3..f23e7ac 100755 --- a/m_lib/net/ftp/ftpscan.py +++ b/m_lib/net/ftp/ftpscan.py @@ -61,7 +61,7 @@ class ReconnectingFTPCallWrapper: class ReconnectingFTPWrapper: ReconnectingFTPCallWrapperClass = ReconnectingFTPCallWrapper - def __init__(self, ftp, ftp_server, ftp_port=None, login=None, password=None, ftp_dir='/', tree=None): + def __init__(self, ftp, ftp_server, ftp_port=0, login=None, password=None, ftp_dir='/', tree=None): self._ftp = ftp self._ftp_server = ftp_server self._ftp_port = ftp_port @@ -121,7 +121,7 @@ def _traverse_ftp(ftp, tree, ftp_dir): ftp.cwd("..") -def ftpscan1(ftp_server, ftp_port=None, login=None, password=None, +def ftpscan1(ftp_server, ftp_port=0, login=None, password=None, ftp_dir='/', passive=None, FTPClass=ftplib.FTP, reconnect=False, ReconnectingFTPWrapperClass=ReconnectingFTPWrapper): """Recursive FTP scan using one-by-one directory traversing. It is slow @@ -144,7 +144,7 @@ def ftpscan1(ftp_server, ftp_port=None, login=None, password=None, return tree -def ftpscanrecursive(ftp_server, ftp_port=None, login=None, password=None, +def ftpscanrecursive(ftp_server, ftp_port=0, login=None, password=None, ftp_dir='/', passive=None, FTPClass=ftplib.FTP, reconnect=False): """ Recursive FTP scan using fast LIST -R command. Not all servers supports @@ -198,7 +198,7 @@ def ftpscanrecursive(ftp_server, ftp_port=None, login=None, password=None, return tree -def ftpscan(ftp_server, ftp_port=None, login=None, password=None, +def ftpscan(ftp_server, ftp_port=0, login=None, password=None, ftp_dir='/', passive=None, FTPClass=ftplib.FTP): try: return ftpscanrecursive(ftp_server, ftp_port, login, password, ftp_dir, passive, FTPClass)