]> git.phdru.name Git - m_lib.git/commitdiff
Fix py3 compatibility: ftp port must be 0, not None
authorOleg Broytman <phd@phdru.name>
Fri, 29 Jul 2016 20:03:02 +0000 (23:03 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 29 Jul 2016 20:03:02 +0000 (23:03 +0300)
m_lib/net/ftp/ftpscan.py

index 51c92f36c9f799f9f3dc319a540861d5dcddb194..f23e7ac39be179d692a8de0f079ef73acbaaa67d 100755 (executable)
@@ -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)