Table of Contents

Class: DccFileReceive Twisted-0.17.4/twisted/protocols/irc.py

Higher-level coverage for getting a file from DCC SEND.

I write the data to a temporary file as it comes in. I I allow you to change the file's name and destination directory. I move the file into place when it's done, but I won't overwrite an existing file unless I've been told it's okay to do so.

XXX: I need to let the client know when I am finished. XXX: I need to decide how to keep a progress indicator updated. XXX: Client needs a way to tell me "Do not finish until I say so." XXX: I need to make sure the client understands if the file cannot be written.

Base Classes   
DccFileReceiveBasic
    protocol.Protocol
    styles.Ephemeral
Methods   
__init__
__repr__
__str__
connectionLost
connectionMade
dataReceived
moveFileIn
set_directory
set_filename
set_overwrite
  __init__ 
__init__ (
        self,
        filename,
        fileSize=-1,
        queryData=None,
        )

  __repr__ 
__repr__ ( self )

  __str__ 
__str__ ( self )

  connectionLost 
connectionLost ( self )

When the connection is lost, I close the file.

and then I moveFileIn().

  connectionMade 
connectionMade ( self )

  dataReceived 
dataReceived ( self,  data )

  moveFileIn 
moveFileIn ( self )

Move the file from its temporary location to its proper name and path.

Called once the connetion is closed, but you may want to call it again in case it does not succeed the first time.

Will raise OSError with ETXTBSY if called before the file is closed.

Exceptions   
OSError( errno.EEXIST, "There's a file in the way. " "Perhaps that's why you cannot move it.", dst )
OSError( errno.ETXTBSY, "The receiving socket is still eating.", self.file.name )
  set_directory 
set_directory ( self,  directory )

Set the directory where the downloaded file will be placed.

May raise OSError if the supplied directory path is not suitable.

Exceptions   
OSError( errno.EACCES, "This directory is too hard to write in to.", directory )
OSError( errno.ENOENT, "You see no directory there.", directory )
OSError( errno.ENOTDIR, "You cannot put a file into " "something which is not a directory.", directory )
  set_filename 
set_filename ( self,  filename )

Change the name of the file being transferred.

This replaces the file name provided by the sender.

  set_overwrite 
set_overwrite ( self,  boolean )

May I overwrite existing files?


Table of Contents

This document was automatically generated on Sat Apr 20 01:31:04 2002 by HappyDoc version 2.0