Changeset 873:4f4a4541b97a

Show
Ignore:
Timestamp:
2010-06-17 11:49:11 (6 weeks ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Handle status code 150 for an incomplete transfer (see ticket #51).
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • _test_real_ftp.py

    r869 r873  
    570570    # 
    571571    def test_open_for_reading(self): 
    572         # test for issue #17, http://ftputil.sschwarzer.net/trac/ticket/17 
     572        # test for issues #17 and #51, 
     573        #  http://ftputil.sschwarzer.net/trac/ticket/17 and 
     574        #  http://ftputil.sschwarzer.net/trac/ticket/51 
     575        file1 = self.host.file("debian-keyring.tar.gz", 'rb') 
     576        time.sleep(1) 
     577        # depending on the FTP server, this might return a status code 
     578        #  unexpected by `ftplib`, or block the socket connection until 
     579        #  a server-side timeout 
     580        file1.close() 
     581 
     582    def test_subsequent_reading(self): 
     583        # opening a file for reading 
    573584        file1 = self.host.file("debian-keyring.tar.gz", 'rb') 
    574585        file1.close() 
     
    615626    server, user, password = get_login_data() 
    616627    unittest.main() 
    617  
     628    import __main__ 
     629    #unittest.main(__main__, "RealFTPTest.test_open_for_reading") 
     630 
  • ftp_file.py

    r869 r873  
    216216                ftp_error._try_with_ioerror(self._session.voidresp) 
    217217            except ftp_error.FTPIOError, exception: 
    218                 # ignore some errors, see ticket #17 at 
    219                 #  http://ftputil.sschwarzer.net/trac/ticket/17 
     218                # ignore some errors, see tickets #51 and #17 at 
     219                #  http://ftputil.sschwarzer.net/trac/ticket/51 and 
     220                #  http://ftputil.sschwarzer.net/trac/ticket/17, 
     221                #  respectively 
    220222                error_code = str(exception).split()[0] 
    221                 if error_code not in ("426", "450", "451"): 
     223                if error_code not in ("150", "426", "450", "451"): 
    222224                    raise 
    223225        finally: