Changeset 549

Show
Ignore:
Timestamp:
2006-08-17 11:50:13 (2 years ago)
Author:
schwa
Message:
Added a workaround for issue #17.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/_test_real_ftp.py

    r529 r549  
    6868 
    6969    def make_file(self, path): 
    70         file = self.host.file(path, 'wb') 
    71         file.close() 
     70        file_ = self.host.file(path, 'wb') 
     71        file_.close() 
     72 
     73    def test_open_for_reading(self): 
     74        # test for issue #17, http://ftputil.sschwarzer.net/trac/ticket/17 
     75        file1 = self.host.file("debian-keyring.tar.gz", 'rb') 
     76        file1.close() 
     77        # make sure that there are no problems if the connection is reused 
     78        file2 = self.host.file("debian-keyring.tar.gz", 'rb') 
     79        file2.close() 
     80        self.failUnless(file1._session is file2._session) 
    7281 
    7382    def test_time_shift(self): 
  • trunk/ftp_file.py

    r529 r549  
    226226            self._fo.close() 
    227227            ftp_error._try_with_ioerror(self._conn.close) 
    228             ftp_error._try_with_ioerror(self._session.voidresp) 
     228            try: 
     229                ftp_error._try_with_ioerror(self._session.voidresp) 
     230            except ftp_error.FTPIOError, exception_: 
     231                # ignore some errors, see ticket #17, 
     232                #  http://ftputil.sschwarzer.net/trac/ticket/17 
     233                error_code = str(exception_).split()[0] 
     234                if error_code not in ("426", "450"): 
     235                    raise 
    229236            self.closed = True 
    230237