Opened 12 years ago

Closed 12 years ago

#2735 defect closed fixed (fixed)

twisted.vfs.adapters.ftp._FileToConsumerAdapter doesn't fully implement IConsumer

Reported by: therve Owned by:
Priority: normal Milestone:
Component: vfs Keywords:
Cc: Branch:


_FileToConsumerAdapter pretends to implement IConsumer, but doesn't define registerProducer and unregisterProducer.

I don't see how this could ever work. Maybe it didn't?

Change History (6)

comment:1 Changed 12 years ago by KyleJ

This worked for me:

class _FileToConsumerAdapter:

    producer = None
    producerIsStreaming = None

    def __init__(self, original):
        self.original = original
        self.offset = 0

    def write(self, bytes):
        self.original.writeChunk(self.offset, bytes)
        self.offset += len(bytes)

    def registerProducer(self, producer, streaming):
        self.producer = producer
        self.producerIsStreaming = streaming

    def unregisterProducer(self):
        if self.producer is not None:
            del self.producer
            del self.producerIsStreaming

comment:2 Changed 12 years ago by therve

Owner: changed from cablehead to therve

comment:3 Changed 12 years ago by therve

Resolution: fixed
Status: newclosed

(In [21220]) Merge vfs-ftp-1264+2735

Author: therve Reviewers: cablehead, exarkun Fixes #1264 Fixes #2735

Add tests for FTP interfaces IFTPShell, IReadFile and IWriteFile. This led to some cleanups in ftp.FTPShell, and removed several bugs in vfs ftp adapter and inmem backend.

comment:4 Changed 12 years ago by therve

Resolution: fixed
Status: closedreopened

comment:5 Changed 12 years ago by therve

Resolution: fixed
Status: reopenedclosed

(In [21793]) Merge vfs-ftp-1264+2735-2

Author: therve Reviewers: jml, exarkun, cablehead Fixes #1264 Fixes #2735

Refactor tests for the vfs ftp adapter, using the new IFTPShellTestsMixin, and fixe behavior both in the ftp adapter and in the inmem backend.

comment:6 Changed 9 years ago by <automation>

Owner: therve deleted
Note: See TracTickets for help on using tickets.