Ticket #6284: 6284-2.diff

File 6284-2.diff, 1.7 KB (added by Adi Roiban, 8 years ago)

applied on top of 7fd78ad tomprince 2013-03-18 Apply 6248-ftp-stor-folder.diff from adiroiban.

  • twisted/protocols/ftp.py

    diff --git a/twisted/protocols/ftp.py b/twisted/protocols/ftp.py
    index 09ec8a5..655fd63 100644
    a b class FTP(object, basic.LineReceiver, policies.TimeoutMixin): 
    12201220            Called from data transport when there are errors during the
    12211221            transfer.
    12221222            """
    1223             if err.check(FTPCmdError):
    1224                 return (err.value.errorCode, '/'.join(newsegs))
    1225 
    12261223            log.msg("Unexpected error received during transfer:")
    12271224            log.err(err)
     1225            if err.check(FTPCmdError):
     1226                return err
    12281227            return (CNX_CLOSED_TXFR_ABORTED,)
    12291228
    12301229        d = self.shell.openForWriting(newsegs)
  • twisted/test/test_ftp.py

    diff --git a/twisted/test/test_ftp.py b/twisted/test/test_ftp.py
    index 5ae8e3d..1f251da 100644
    a b class FTPServerTestCaseAdvancedClient(FTPServerTestCase): 
    625625        # Make a failing file writer.
    626626        class FailingFileWriter(ftp._FileWriter):
    627627            def receive(self):
    628                 return defer.fail(ftp.IsADirectoryError("blah"))
     628                return defer.fail(ftp.IsADirectoryError("failing_file"))
    629629
    630630        def failingSTOR(a, b):
    631631            return defer.succeed(FailingFileWriter(None))
    class FTPServerTestCaseAdvancedClient(FTPServerTestCase): 
    636636
    637637        def eb(res):
    638638            res.trap(ftp.CommandFailed)
     639            logs = self.flushLoggedErrors()
     640            self.assertEqual(1, len(logs))
     641            self.assertIsInstance(logs[0].value, ftp.IsADirectoryError)
    639642            self.assertEqual(
    640643                res.value.args[0][0],
    641644                "550 failing_file: is a directory")