Opened 7 years ago

Closed 7 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:
Author: Launchpad Bug:

Description

_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 7 years ago by KyleJ

This worked for me:

class _FileToConsumerAdapter:
    implements(IConsumer)

    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 7 years ago by therve

  • Owner changed from cablehead to therve

comment:3 Changed 7 years ago by therve

  • Resolution set to fixed
  • Status changed from new to closed

(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 7 years ago by therve

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:5 Changed 7 years ago by therve

  • Resolution set to fixed
  • Status changed from reopened to closed

(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 3 years ago by <automation>

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